Jump to content

AJAX errors


fugix

Recommended Posts

alright guys this one has me stumped...i have this function

function showFriends()  {

    var xhr; 
if(window.XMLHttpRequest)  {

	xhr = new XMLHttpRequest();
} else if(window.ActiveXObject)  {

	try  {

		xhr = new ActiveXObject("Msxml2.XMLHTTP");
	} catch(e)  {

		try  {

			xhr = new ActiveXObject("Microsoft.XMLHTTP");
		} catch(e) {}
	}
}	

    xhr.onreadystatechange  = function()
    { 
         if(xhr.readyState  == 4)
         {
              if(xhr.status  == 200) 
                  alert("success");
              else 
                 alert('Problem with readyState');
         } else {

	alert("Problem with status");
}
    }; 

   xhr.open("GET", "test.txt",  true); 
   xhr.send(null); 
};

just to see if I can grab text from a text file when i click a button...when i click the button is triggers the function correctly, however i receive both status and readyState Problem errors...im not sure if this is because it cant grab the data from the text file or what...any suggestions? thanks

Link to comment
https://forums.phpfreaks.com/topic/237717-ajax-errors/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.