summaryrefslogtreecommitdiff
path: root/ajax.js
diff options
context:
space:
mode:
Diffstat (limited to 'ajax.js')
-rw-r--r--ajax.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/ajax.js b/ajax.js
new file mode 100644
index 0000000..8d08eab
--- /dev/null
+++ b/ajax.js
@@ -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