473,663 Members | 2,738 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

xmlhttprequest http.status unknown

25 New Member
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 2240
pbmods
5,821 Recognized Expert Expert
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
1457
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") on top (yello horizontal bar on top): http://www.auriance.com/docs/alcan/index.php How can I fix it? Thanks, -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ Discover Opera: http://members.surfeu.fi/jerkku/
1
5680
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 before the network operation finishes? My usage pattern is:
2
6530
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. From my research so far, it seems like this is a security issue related to the fact that I am trying to access a url on a second server. Both servers are under my control, however. Is there a way to get around this
42
34148
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 1.07/Linux, Firefox 1.5/Linux, Firefox 1.5/Windows and Firefox 1.5/Mac, Safari/Mac. It works perfectly on a lot of configurations but, on some PC with Firefox 1.5/Windows (not all), the Javascript code with XmlHttpRequest
6
7281
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 readyState is always set to 1 (loading). Ive tried using the same XMLHTTPRequest object, and making a 2nd XMLHTTPRequest object with the same results. Heres my code thats giving me problems... function RefreshChat() {
1
4169
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 onreadystatechange to another function of mine. onreadystatechange checks the ready state and if the ready state is 4 and the status is 200 it assigns to the innerHTML of a div. I also have some code that uses the attachEvent method so that all...
2
6189
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. {__start_of_code__} ('piece' of code) ....
0
8436
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8345
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8858
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8771
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8548
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
5657
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4349
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2000
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1757
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.