Web Applications and HTTP Status Codes...
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: Web Applications and HTTP Status Codes...

  1. #1

    Web Applications and HTTP Status Codes...

    Is it possible/do web applications developers ever purposely set/send out a HTTP Status Code, so that it can be better hanled client side by pages utilizing ajax?

  2. #2
    PeejAvery's Avatar
    PeejAvery is offline Super Moderator Power Poster
    Join Date
    May 2002
    Posts
    10,860

    Re: Web Applications and HTTP Status Codes...

    I'm slightly confused by your question. Do you mean the following?

    Code:
    objXML.status = 200;
    Sometimes, to make pages smoothly operate, I ignore the status altogether. As long as the readyState is set, most times it will be without error.
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  3. #3

    Re: Web Applications and HTTP Status Codes...

    Yea, for example error handling, you might handle an exception in your backend code which your javascript doesn't have full visibility of, therefore with your exception you might also send a status code, so that the javascript can be,

    Code:
    if (xmlhttp.status == mystatus) 
    { 
       document.findelementbyid("foo").value="there has been some error"; 
    }
    It seems sensible, but I don't know if it can be done, or if anyone does it, or if there is any need to.

  4. #4
    PeejAvery's Avatar
    PeejAvery is offline Super Moderator Power Poster
    Join Date
    May 2002
    Posts
    10,860

    Re: Web Applications and HTTP Status Codes...

    Well, why don't you build a simple AJAX object, and try to set the status. Personally, I don't really find use for it because the status applies to the server page status. Why would you need more than...

    Code:
    if (objXML.status == 200) {alert("Page found.");}
    ...
    else if (objXML.status == 403) {alert("Access denied.");}
    else if (objXML.status == 404) {alert("URL not found.");}
    ...
    else {alert("status is " + request.status);}
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center