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 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
|
function updateEchelon(e) {
ajaxCallRemotePage('AjaxUpdateEchelon.do?grade='+e,'echelon');
}
// Methode d'appel a une page en XmlHttpRequest
function ajaxCallRemotePage(url, method){
if (window.XMLHttpRequest)
{
// Non-IE browsers
req = new XMLHttpRequest();
if (method == 'echelon') {
req.onreadystatechange = processStateChangeEchelon;
} else if (method == 'indice'){
alert ('update indice');
req.onreadystatechange = processStateChangeIndice;
}else {
alert ('unknown method'+method);
}
req.open("GET", url, true);
req.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT");
req.send(null);
}
else if (window.ActiveXObject)
{
// IE
req = new ActiveXObject("Microsoft.XMLHTTP");
if (method == 'echelon') {
req.onreadystatechange = processStateChangeEchelon;
} else if (method == 'indice'){
alert ('update indice');
req.onreadystatechange = processStateChangeIndice;
}else {
alert ('unknown method'+method);
}
req.open("GET", url, true);
req.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT");
req.send();
}
else {
alert ('Abandon, impossible de créer une instance XMLHTTP');
return; // Navigateur non compatible
}
} |
Partager