1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
function createXhrObject(){
var xhr_object=null;
if(window.XMLHttpRequest) // Firefox
xhr_object = new XMLHttpRequest();
else if(window.ActiveXObject) // Internet Explorer
xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
else { // XMLHttpRequest non supporté par le navigateur
alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest...");
return;
}
return xhr_object; // non supporté
}
function chargeDiv(objDiv _url){
xhr = createXhrObject();
var method = "POST";
xhr.open( method, (_url, true);
xhr.onreadystatechange = function(){
if(xhr.readyState == 4){
if(xhr.status == 200){
//ici l'action pour modifier l'objet Dom de la Div objDiv
}
}
};
} |
Partager