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?  ???

Link to comment
Share on other sites

 

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.');

        }

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.