Лабораторная работа: XMLHttpRequest (AJAX)

if (window. XMLHttpRequest) {

request = new XMLHttpRequest();

request. onreadystatechange = processRequestChange;

request. open("GET", url, true);

request. send(null);

} else if (window. ActiveXObject) {

request = new ActiveXObject("Microsoft. XMLHTTP");

if (request) {

request. onreadystatechange = processRequestChange;

request. open("GET", url, true);

request. send();

}

}

}

/**

* Get request state text function

*/

function getRequestStateText(code) {

switch (code) {

case 0: return "Uninitialized. "; break;

case 1: return "Loading... "; break;

case 2: return "Loaded. "; break;

case 3: return "Interactive... "; break;

case 4: return "Complete. "; break;

}

}

/**

* Event on request change

* Собственно, обработчик события onreadystatechange.

К-во Просмотров: 292
Бесплатно скачать Лабораторная работа: XMLHttpRequest (AJAX)