473,401 Members | 2,127 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,401 software developers and data experts.

xmlhttprequest http.status unknown

25
I am having a problem getting the http.status of an xmlhttprequest. The request readystate has come back as readystate 4, but then it stops without confirming the http.status. Any help appreciated.

Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript" >
  2. var postring = "?";
  3. function string()
  4.     {
  5.         var first = document.numbers.first.value;
  6.         var second = document.numbers.second.value;
  7.         var third = document.numbers.third.value;
  8.         postring += "first=" + first + "&second=" + second + "&third=" + third;
  9.         alert(postring);
  10.         insert();
  11.     }
  12. function insert(url)
  13.     {
  14.     var url="http://localhost/Project/Hi.php";
  15.         var http;
  16.  
  17.         if (window.XMLHttpRequest) 
  18.         { // Mozilla, Safari, ...
  19.             http = new XMLHttpRequest();
  20.             if (http.overrideMimeType) 
  21.             {
  22.                 http.overrideMimeType('text/xml');
  23.                 // See note below about this line
  24.             }
  25.         } 
  26.         else if (window.ActiveXObject) 
  27.         { // IE
  28.             try {
  29.                 http = new ActiveXObject("Msxml2.XMLHTTP");
  30.                 } 
  31.                 catch (e)
  32.                 {
  33.                  try {
  34.                       http = new ActiveXObject("Microsoft.XMLHTTP");
  35.                       } 
  36.                  catch (e) {}
  37.                 }
  38.         }
  39.         if (!http) 
  40.         {
  41.             alert('Giving up :( Cannot create an XMLHTTP instance');
  42.             return false;
  43.         }
  44.         alert('ok');
  45.         http.onreadystatechange = function()
  46.         {
  47.         if (!http.readyState)  
  48.             {
  49.                alert('There was a problem with the request.');
  50.             }
  51.         else
  52.         alert(http.readyState);
  53.         if (http.readystate == 4)
  54.             {
  55.             alert(http.Status);
  56.             if (http.Status ==  200)
  57.                 {
  58.                 response = http.responseText;
  59.                 alert(response);
  60.                 document.numbers.first.value = "";
  61.                 document.numbers.second.value = "";
  62.                 document.numbers.third.value = "";
  63.                 }
  64.             }
  65.         }
  66.         http.open('POST', url+postring, true);
  67.         http.send('');
  68.     }
  69. </script>
  70.  
Aug 21 '07 #1
1 2222
pbmods
5,821 Expert 4TB
Heya, rpjd.

Is it http.Status, or http.status?
Aug 21 '07 #2

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

Similar topics

2
by: Unknown User | last post by:
I am trying to implement XMLHttpRequest to a new website, but when I include HTML, the code appears as is, instead of the formated HTML. Please have a look and click the 1st link ("L'Association")...
1
by: Henri Sivonen | last post by:
I got the following error: Error: " nsresult: "0x80040111 (NS_ERROR_NOT_AVAILABLE)" .... with Firefox when using XMLHttpRequest. What's happenening? Is the object being garbage collected...
2
by: dx27s | last post by:
Hi all, I'm working with the XMLHttpRequest object. I receive the following error message: "Permission denied to call method XMLHttpRequest.open" This occurs in Firefox only. IE works fine. ...
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: Nathan | last post by:
Can I run two XMLHTTPRequest objects at the same time? Im able to get one to work without problems. If I put a call to a function inside the first ones onreadystatechange function, the 2nd ones...
1
by: mathewda | last post by:
Hey, I'm having a problem that I consider kinda weird that is alluding me at the moment. I've wrote some code that will set up an XMLHttpRequest, it then makes a call to open and send and sets the...
2
by: jhullu | last post by:
hello, I'm writing a program using XMLHttpRequest that works in the main case on IE and mozilla but this code works only on IE ... why ? probleme is located at mark 'HERE' at the end of code....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.