0
How can i send javascript values to php using ajax?
Can anyone provide me sime simple example?
2 Answers
+ 18
var params = "name=" + encodeURIComponent(name) +
"&surname=" + encodeURIComponent(surname);
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
// if success, do something with this.responseText;
}
};
xhttp.open("POST", "index.php", true);
xhttp.send(params);
0
thank a lot