Xhr.send (params) - несколько параметров ⇐ Php

Кемеровские программисты php общаются здесь
Anonymous
Xhr.send (params) - несколько параметров

Сообщение Anonymous »

Я пытаюсь передать несколько параметров, но не знаю синтаксис .. pplz help < /p>

function formSubmit() {

var name = document.getElementById('name').value;
var email = document.getElementById('email').value;
var phone = document.getElementById('phone').value;
var message = document.getElementById('message').value;

// This is where the problem is:
var params = "name="+name&"email="+email&"phone="+phone&"message="+message;

var xhr = new XMLHttpRequest;
xhr.open('POST' , 'ajax.php', true);
xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded')

xhr.onload = function() {
if(this.status ==200) {
console.log(this.responseText);
}
}
xhr.send(params);
}


Подробнее здесь: https://stackoverflow.com/questions/513 ... parameters

Вернуться в «Php»