Сообщение от Deff
|
Tecvid,
Аякс - из jQuery ? или откель ?
|
function ajax(options) {
function getXmlHttp() {
var xmlhttp;
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (E) {
xmlhttp = false;
}
}
if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
xmlhttp = new XMLHttpRequest();
}
return xmlhttp;
}
var xmlhttp = getXmlHttp(),
type = options.type || 'GET';
xmlhttp.open(type, options.url, true);
xmlhttp.setRequestHeader('X-REQUESTED-WITH', 'XMLHttpRequest');
xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4) {
if(xmlhttp.status == 200) {
options.success(xmlhttp.responseText);
}
}
};
var data = options.data || null;
xmlhttp.send(data);
}