Save bytes

This commit is contained in:
Jakub Vrana 2010-10-17 07:19:01 +02:00
parent 7eb85a75f8
commit 8d4b241156

View file

@ -139,14 +139,8 @@ var ajaxTimeout;
* @return XMLHttpRequest or false in case of an error * @return XMLHttpRequest or false in case of an error
*/ */
function ajax(url) { function ajax(url) {
var xmlhttp; var xmlhttp = (window.XMLHttpRequest ? new XMLHttpRequest() : (window.ActiveXObject ? new ActiveXObject('Microsoft.XMLHTTP') : false));
if (window.XMLHttpRequest) { if (xmlhttp) {
xmlhttp = new XMLHttpRequest();
} else if (window.ActiveXObject) {
xmlhttp = new ActiveXObject('Microsoft.XMLHTTP');
} else {
return false;
}
var currentState = ++ajaxState; var currentState = ++ajaxState;
clearTimeout(ajaxTimeout); clearTimeout(ajaxTimeout);
ajaxTimeout = setTimeout(function () { ajaxTimeout = setTimeout(function () {
@ -164,6 +158,7 @@ function ajax(url) {
} }
}; };
xmlhttp.send(''); xmlhttp.send('');
}
return xmlhttp; return xmlhttp;
} }