I've got this code, and i don't see where the problem is :
if (window.XMLHttpRequest || window.ActiveXObject) {
var id = $(this).attr("id");
alert("bon");
xhr =getXMLHttpRequest();
xhr.open("POST", "handlingData.php",true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.send("type="+$('input[name="type'+id+'"]').val()+"&titre="+$('input[name="titre'+id+'"]').val()+"&texte="+$('input[name="texte'+id+'"]').val()+"&reponse="+$('input[name="reponse'+id+'"]').val());
}
what i wanted to do was to send data in a POST.
Here's getXMLHttpRequest() :
function getXMLHttpRequest() {
var xhr = null;
if (window.XMLHttpRequest || window.ActiveXObject) {
if (window.ActiveXObject) {
try {
xhr = new ActiveXObject("Msxml2.XMLHTTP");
} catch(e) {
xhr = new ActiveXObject("Microsoft.XMLHTTP");
}
} else {
xhr = new XMLHttpRequest();
}
} else {
alert("Votre navigateur ne supporte pas l'objet XMLHTTPRequest...");
return null;
}
return xhr;
}