473,386 Members | 1,886 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

What does status 0 in ajax mean?

108 100+
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3.         <script type="text/javascript" src=ajax.js></script>
  4.  
  5.         </script>
  6.         <style type='text/css'>
  7.         </style>
  8.     </head>    
  9.     <body onload='makePOSTRequest("video_videos.php","display_details")'>
  10. <div id='display_details'></div>
  11. </body>
  12. </html>
My ajax func is defined in an external file ajax.js
Expand|Select|Wrap|Line Numbers
  1. function makePOSTRequest(filename,id)
  2.             {
  3.                 if (window.XMLHttpRequest)     // Object of the current windows
  4.                 { 
  5.                         xhr = new XMLHttpRequest();   
  6.                 } 
  7.             else 
  8.                  if (window.ActiveXObject)   // ActiveX version
  9.                      {
  10.                             xhr = new ActiveXObject("Microsoft.XMLHTTP");  // Internet Explorer 
  11.                      } 
  12.  
  13.               xhr.onreadystatechange =function chk()
  14.                     {alert(xhr.status);
  15.  
  16.                         if (xhr.readyState == 4){
  17.  
  18.                             if (xhr.status==200){
  19.  
  20.                                     document.getElementById(id).innerHTML=xhr.responseText;    
  21.                                     alert(xhr.responseText);
  22.                                 }
  23.                                 }
  24.  
  25.                     }
  26.             xhr.open('GET', filename, true);                  
  27.         xhr.send(null); 
  28.  
  29.                     }
I just implemented a small script for ajax and when i rin it I get the status to be 0.
What does that mean?
Apr 26 '10 #1

✓ answered by Dormilich

you (resp. the XMLHttpRequest object) will go through each readyState, no need to debug something. besides, you can only get a HTTP status code, if the server responds (that is, not before readyState 2) and I would only be concerned if the status is not 200 or 0.

3 5023
Dormilich
8,658 Expert Mod 8TB
in case of .status, the local file system does not send HTTP status codes, thus 0.

the .readyState 0 means "unsent"
Apr 26 '10 #2
phpuser123
108 100+
Is there any way to debug the status 0..I've been getting this a couple of times
...
Apr 27 '10 #3
Dormilich
8,658 Expert Mod 8TB
you (resp. the XMLHttpRequest object) will go through each readyState, no need to debug something. besides, you can only get a HTTP status code, if the server responds (that is, not before readyState 2) and I would only be concerned if the status is not 200 or 0.
Apr 27 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Anaam | last post by:
I have a page which is using html area and it is also uploading image files to be place in an HTML file on server side. im using ajax to send requests to server side. page works fine, image is...
21
by: thomson | last post by:
Hi folks, Does any one have any idea which platform does GMAIL works, whether its JSP, ASPX or any other Regards thomson
42
by: Greg | last post by:
Hi, I've designed a bookmark in Ajax / PHP that I will put soon on sourceforge.net. But I've got an very tricky bug. I try it on some computers with Internet Explorer/Windows, Firefox...
6
by: Dica | last post by:
i wrote an app using ajax.net and i'm told that the hosting outfit wants $10 to set up the dll PLUS $10 every month to 'maintain it because it's a custom dll'. i've stated to look at atlas, but it...
4
by: _Raven | last post by:
Okay, I am playing with submitting forms with Ajax. I am trying to adapt this script to my forms: http://www.captain.at/howto-ajax-form-post-get.php I have included my code at the bottom of this...
1
by: kamleshsharmadts | last post by:
I am using Ajax with struts in web application. from jsp i am calling a function of ajax.js onclick of a button. code of that call function which calling from jsp given as below:- ...
3
by: CT | last post by:
Dear All, Is there any to show progress status of all activities like database retrieval, navigation from one page to another page? I am looking for some source code to integrated in my .net...
1
by: quayum | last post by:
Hi I am using the AJAX to call a method on the server which sends a mail to the user. my code if(status == 200) is evaluating to false yet the mail is delivered. But because of the above...
29
by: zalek | last post by:
I am writing application with Ajax in sync mode - xmlHttp.open("GET", url, false). I noticed that in FireFox handler doesn't starts. It starts when I use xmlHttp.open("GET", url,true). I need to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.