Athgar Posted December 8, 2008 Share Posted December 8, 2008 I have an ajax file which I did not write myself which has the following function : http_request.onreadystatechange = function() { if(http_request.readyState < 4) { loadElement.innerHTML = '<img src="/images/ajax-loader.gif" alt="Loading" /> Requesting information...'; } else if(http_request.readyState == 4){ if(http_request.status == 200) { outputElement.innerHTML = http_request.responseText; } else { outputElement.innerHTML = 'There was a problem with the request.'; } } } The output of this code is always 'There was a problem with the request' when it is called from php files and I don't know why. I know very little about Ajax and I haven't been able to find anything pertinent from my own searches. I'd be very grateful for any advice Link to comment https://forums.phpfreaks.com/topic/136081-issue-with-ajax-script/ Share on other sites More sharing options...
rhodesa Posted December 8, 2008 Share Posted December 8, 2008 in the else, change the line to: outputElement.innerHTML = 'There was a problem with the request. '+http_request.status; to see what the status is. Link to comment https://forums.phpfreaks.com/topic/136081-issue-with-ajax-script/#findComment-709572 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.