473,320 Members | 1,958 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,320 software developers and data experts.

xmlrequest status codes

2
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.statusText 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("GET", "test.txt",true);
xmlhttp.onreadystatechange=function() {

if (xmlhttp.readyState==4) {
window.alert("Show the stuff");}
}
xmlhttp.send(null)

window.alert(xmlhttp.readyState);
window.alert(xmlhttp.responsetext);
window.alert(xmlhttp.responseXML);
window.alert(xmlhttp.status);
window.alert(xmlhttp.statusText);
Mar 16 '07 #1
4 6524
dols
2
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.XMLHTTP");

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

function example() {

xmlhttp.open("GET","just some text.txt",true);
xmlhttp.onreadystatechange=function() {


if (xmlhttp.readyState == 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.readyState==4) {
if (xmlhttp.status==0) { // !! This should be 200 since all seems right

var local=new Function("return "+xmlhttp.responseText)();
window.alert(xmlhttp.responseText);

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

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

} // end statechangefunction

} // end example function

xmlhttp.send(null);

}
</script>
Mar 17 '07 #2
quill
12
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
xmlhttp.open("GET", "test.txt",true);
xmlhttp.onreadystatechange=function() {

if (xmlhttp.readyState==4) {
window.alert("Show the stuff");}
}
xmlhttp.send(null)

window.alert(xmlhttp.readyState);
window.alert(xmlhttp.responsetext);
window.alert(xmlhttp.responseXML);
window.alert(xmlhttp.status);
window.alert(xmlhttp.statusText);
Here's a link:

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

Check out table 2.
Mar 17 '07 #4
acoder
16,027 Expert Mod 8TB
Merged threads.
Mar 19 '07 #5

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

Similar topics

9
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...
1
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...
2
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...
4
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)....
6
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...
0
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...
1
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...
2
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...
10
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...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.