aximbigfan Posted March 30, 2008 Share Posted March 30, 2008 I have been trying for a long time, I just want this function to return a var, but no matter what, it doesn't work. function ajax(url) { var http = window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest(); http.onreadystatechange = function() { if (http.readyState == 4) { if (http.status == 200) { return http.responseText; } else { alert("AJAX Error! \nReturned Text: "+ http.statusText); } } } http.open("GET" ,url , true); http.send(null); } Anyone? Thanks, Chris Quote Link to comment Share on other sites More sharing options...
nogray Posted March 31, 2008 Share Posted March 31, 2008 If the files on your computer (local drive) this might not work if (http.status == 200) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.