473,699 Members | 2,628 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

xmlrequest status codes

2 New Member
Hello,

below the fragment that works fine, but nevertheless, the value of xmlhttp.status
turns out to be zero (0), and the corresponding value for xmlhttp.statusT ext is "unknown".

Does anyone know the details of ALL the statuscodes when the value for readyState is 4 (= completed).


Also, where could I have found the answer myself???

thanks,

Frens


xmlhttp.open("G ET", "test.txt",true );
xmlhttp.onready statechange=fun ction() {

if (xmlhttp.readyS tate==4) {
window.alert("S how the stuff");}
}
xmlhttp.send(nu ll)

window.alert(xm lhttp.readyStat e);
window.alert(xm lhttp.responset ext);
window.alert(xm lhttp.responseX ML);
window.alert(xm lhttp.status);
window.alert(xm lhttp.statusTex t);
Mar 16 '07 #1
4 6536
dols
2 New Member
Hello,

anyone know why status code after the GET and SEND is 0?

It should be 200 since the file has been loaded and can be assessed.

thanks,

Frens



<script type="text/javascript">


var xmlhttp;

xmlhttp = new ActiveXObject(" Microsoft.XMLHT TP");

if (xmlhttp) {
document.write( '<p class="example" ><a href="#" onclick="exampl e();return false;">Try the example.</a></p>')
}

function example() {

xmlhttp.open("G ET","just some text.txt",true) ;
xmlhttp.onready statechange=fun ction() {


if (xmlhttp.readyS tate == 4)
if (xmlhttp.status == 200)
alert("Server is done!");
else if (xmlhttp.status == 404)
alert("Request URL does not exist");
else
alert("Error: status code is " + xmlhttp.status) ;

if (xmlhttp.readyS tate==4) {
if (xmlhttp.status ==0) { // !! This should be 200 since all seems right

var local=new Function("retur n "+xmlhttp.respo nseText)();
window.alert(xm lhttp.responseT ext);

window.alert("C ode - Name\n"+local[0].id+' - '+local[0].name);

} else {
alert("not found");
}

} // end statechangefunc tion

} // end example function

xmlhttp.send(nu ll);

}
</script>
Mar 17 '07 #2
quill
12 New Member
Hi,

Your ajax code seems to rely on IE (activeX). Try looking at

http://www-128.ibm.com/developerworks/web/library/wa-ajaxintro1.html

And use the cross-browser Ajax code.
Mar 17 '07 #3
quill
12 New Member
xmlhttp.open("G ET", "test.txt",true );
xmlhttp.onready statechange=fun ction() {

if (xmlhttp.readyS tate==4) {
window.alert("S how the stuff");}
}
xmlhttp.send(nu ll)

window.alert(xm lhttp.readyStat e);
window.alert(xm lhttp.responset ext);
window.alert(xm lhttp.responseX ML);
window.alert(xm lhttp.status);
window.alert(xm lhttp.statusTex t);
Here's a link:

http://developer.apple.com/internet/...mlhttpreq.html

Check out table 2.
Mar 17 '07 #4
acoder
16,027 Recognized Expert Moderator MVP
Merged threads.
Mar 19 '07 #5

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

Similar topics

9
2336
by: Gianni Mariani | last post by:
I'm involved in a new project and a new member on the team has voiced a strong opinion that we should utilize exceptions. The other members on the team indicate that they have either been burned with unmaintainable code (an so are now not using exceptions). My position is that "I can be convinced to use exceptions" and my experience was that it let to code that was (much) more difficult to debug. The team decided that we'd give...
1
1975
by: chris fink | last post by:
Hi, What are the appropriate HTTP Status Codes for the following: 1. XML is not well-formed (structure problem).... 2. XML is not valid (as per DTD/XSD/XDR).....missing req'd field, etc I checked out W3C spec and was unable to decide which status codes are best. Any help is appreciated.
2
1942
by: bwmiller16 | last post by:
Anyone - Can anybody tell me where I would find the linux status codes for such udb utilities as backup, etc.? For instance, in my cron job I have: db2 backup database $dir to $BACKUP_DIR with 4 buffers without prompting >>$MSG_FILE 2>&1 STATUS=$?
4
3847
by: Frank Meng | last post by:
Hi. I am trying a csharp sample from http://www.codeproject.com/csharp/socketsincs.asp . (Sorry I didn't post all the source codes here, please get the codes from above link if you want to try). I had some troubles when I started 6 threads (each thread made a separate connection) and sent messages to same server simultaneously. Sometimes, not always, the socket looks like ok, but really it is dead. I don't why it happens.
6
2544
by: Andy Fish | last post by:
Hi, I've RTFM'd in vain for some named constants in the asp.net framework representing the HTTP error codes - the equivalent of Java's HttpServletResponse.SC_NOT_FOUND for 404 etc. All the examples I've seen just use numbers. Anyone seen proper constant definitions for these? Andy
0
1492
by: Daniel Kopp | last post by:
Hi! I tried to implement custom error pages using the <customErrors> directive in a web.config file. It worked fine for "simple" errors like HTTP 404, like this example: <customErrors mode="On"> <error statusCode="404" redirect="http://localhost/ErrorPages/Error404.aspx"/> </customErrors>
1
2684
by: chen | last post by:
We're having an internal debate about the merits & demerits of returning status codes in the output message vs exceptions to signify errors in handling a Web method. The status code camp is arguing that business rules related errors are to be conveyed using status code while reserving the exception approach (using SoapException) to system related errors (like say database connection issues). This implies that GetFoo() returns a...
2
13752
by: Bob | last post by:
I'm running sql server ver 7.0 SP4. I have an access project (.adp) that runs a view which is nothing more than a select statement. Access locks up solid when I try to run this query - with NO error messages what-so-ever. If I sign onto the server, and run the view from enterprise manager - I get: "the data provider or other service returned an E_FAIL status" !?!?! There is NO ERROR number, or further explanation of the message!!
10
7259
by: anubhavjha | last post by:
Hi Friends, I have a web application through which, the ajax is used to post the data onto the server and return the results. When i alert the xmlhttp.readystate sometimes it takes long time, that the process looks like freezing and sometimes its done very quickly as it is designed to. I checked by alerting xmlhttp.readystate. sometimes i get response 1,2 ,3 4 as the alert box quickly. and sometimes i just get 1 and then nothing...
0
8613
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
9172
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...
1
8908
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
8880
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7745
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6532
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5869
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();...
2
2344
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2008
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.