From baa0a68dcc965833b2c9f0eb31dda045fa3d17c7 Mon Sep 17 00:00:00 2001 From: ozh Date: Thu, 13 Feb 2014 22:18:39 +0100 Subject: Init --- ajax.js | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 ajax.js (limited to 'ajax.js') 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 -- cgit v1.2.3