1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| function item(x)
{
var xhr=null;
if(window.XMLHttpRequest) xhr = new XMLHttpRequest();
else if(window.ActiveXObject) {try {xhr = new ActiveXObject("Msxml2.XMLHTTP");} catch (e) {try {xhr = new ActiveXObject("Microsoft.XMLHTTP");} catch (e1) {xhr = null;}}}
else {alert("Votre navigateur n\'est pas compatible avec les appels ajax");}
if(xhr!=null)
{
xhr.open("POST", "item.php", true);
xhr.onreadystatechange = function()
{
if(xhr.readyState == 4 && xhr.status == 200) eval(xhr.responseText);
}
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhr.send("x="+x);
delete xhr;
}
} |
Partager