M
Mel Smith
Hi:
I've been working with XHR for a couple of months now, and enjoying the
hi-speed interaction between my IE7 browser, and my CGI server.
This morning I decided to test XHR on Chrome, FF, and Safari:
Results:
1. The 'post' request was sent to my server properly.
2. My CGI app sent the same text response I've been sending for a month
now.
3. The response text was apparently not received --- only a status of
zero (0) was returned
So, for IE7 (and IE 6), the reponse came quickly and correctly:
Ready State: 4, and Status: 200
But for all the other browsers I tested, I get:
Ready State: 4, and Status: 0 !!!
So, apparently, the other browsers are getting a response but setting
the status to 0 -- which means they found something wrong with the response
which IE found OK ???
Can anybody help me with this please ??
I'll place the relevant section of XHR code below:
**************************************
HTTP.post = function(url, values, callback) {
var request = HTTP.newRequest();
request.onreadystatechange = function() {
if (request.readyState == 4) {
if (request.status == 200 ) {
callback(request.responseText); // get here correctly
with IE
}
else {
callback(request.status); // Get here with other browsers
and a status of 0.
}
}
}
request.open("POST", url);
// This header tells the server how to interpret the body of the request
request.setRequestHeader("Content-Type",
"application/x-www-form-urlencoded");
// Encode the properties of the values object and send them as
// the body of the request.
request.send(HTTP.encodeFormData(values));
if (clbplr == "clb") clbrequest=request; // set global vrbl clbrequest
if (clbplr == "plr") plrrequest=request; // set global vrbl plrrequest
};
*********************************
Thanks for some guidance here about using XHR with Chrome,FF, and Safari
I've been working with XHR for a couple of months now, and enjoying the
hi-speed interaction between my IE7 browser, and my CGI server.
This morning I decided to test XHR on Chrome, FF, and Safari:
Results:
1. The 'post' request was sent to my server properly.
2. My CGI app sent the same text response I've been sending for a month
now.
3. The response text was apparently not received --- only a status of
zero (0) was returned
So, for IE7 (and IE 6), the reponse came quickly and correctly:
Ready State: 4, and Status: 200
But for all the other browsers I tested, I get:
Ready State: 4, and Status: 0 !!!
So, apparently, the other browsers are getting a response but setting
the status to 0 -- which means they found something wrong with the response
which IE found OK ???
Can anybody help me with this please ??
I'll place the relevant section of XHR code below:
**************************************
HTTP.post = function(url, values, callback) {
var request = HTTP.newRequest();
request.onreadystatechange = function() {
if (request.readyState == 4) {
if (request.status == 200 ) {
callback(request.responseText); // get here correctly
with IE
}
else {
callback(request.status); // Get here with other browsers
and a status of 0.
}
}
}
request.open("POST", url);
// This header tells the server how to interpret the body of the request
request.setRequestHeader("Content-Type",
"application/x-www-form-urlencoded");
// Encode the properties of the values object and send them as
// the body of the request.
request.send(HTTP.encodeFormData(values));
if (clbplr == "clb") clbrequest=request; // set global vrbl clbrequest
if (clbplr == "plr") plrrequest=request; // set global vrbl plrrequest
};
*********************************
Thanks for some guidance here about using XHR with Chrome,FF, and Safari