Jump to content

Web Server Temporarily Unavailable status


DaveEverFade

Recommended Posts

Does anyone know if there is a way of checking if the response from an ajax request is a valid page? To explain more: I have a site that uses ajax heavily for multiple refreshes for example, a msn style shoutbox.

 

This is my stateChanged function

function stateChanged(Div) 
{ 
//alert(request.readyState)

if(request.readyState<4)
	{
	window.status="Loading";
	document.body.style.cursor = 'wait';
	}
if (request.readyState==4 || request.readyState=="complete")
	{ 
	document.getElementById(Div).innerHTML=request.responseText
	window.status="Done";
	document.body.style.cursor = 'auto';
	} 
} 

 

Now what i want to be able to do is identify if the page cannot be displayed (but I don't mean a 404 error or such like). I mean if the server has gone down or something because if that is the case I get a hideous "Web Server Temporarily Unavailable" displayed where my page should be.

 

Any ideas?  ???

 

You can do it by checking the status.

 

  if (http_request.readyState == 4) {

        if (http_request.status == 200) {

           

        } else {

            alert('There was a problem with the request.');

        }

 

 

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.