diff options
| author | ozh <ozh@ozh.org> | 2014-02-13 22:18:39 +0100 |
|---|---|---|
| committer | ozh <ozh@ozh.org> | 2014-02-13 22:18:39 +0100 |
| commit | baa0a68dcc965833b2c9f0eb31dda045fa3d17c7 (patch) | |
| tree | 5abe09270abfe24679406dab7be9105134dd10eb /ajax.js | |
Init
Diffstat (limited to 'ajax.js')
| -rw-r--r-- | ajax.js | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -0,0 +1,6 @@ +function ajax(url,callback){ + var ajaxRequest; + try{ajaxRequest = new XMLHttpRequest();} catch (e){try{ajaxRequest=new ActiveXObject('Msxml2.XMLHTTP');} catch (e) {try{ajaxRequest=new ActiveXObject('Microsoft.XMLHTTP');} catch (e){alert("Something broke!");return false;}}} + if (callback){ajaxRequest.onreadystatechange=function(){if(ajaxRequest.readyState==4){callback(ajaxRequest.responseText);}}} + ajaxRequest.open('GET',url+'&nocache='+(new Date().getTime()),true);ajaxRequest.send(null); +}
\ No newline at end of file |