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 Link to comment https://forums.phpfreaks.com/topic/98554-cannot-get-return-to-work/ 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) Link to comment https://forums.phpfreaks.com/topic/98554-cannot-get-return-to-work/#findComment-505855 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.