Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Problem with XMLHTTP request. Please help! (long)

Reply
Thread Tools

Problem with XMLHTTP request. Please help! (long)

 
 
Robert Cholewa
Guest
Posts: n/a
 
      11-23-2004
Hi

I'm using Microsoft.XMLHTTP object from within JavaScript HTA
application (or WScript).
Object is set to use asynchronous mode as following:

---------
var oXMLRequest = new ActiveXObject("Microsoft.XMLHTTP");
var sURL = "http://www.url.com/page.jsp";
var sParams = "param1=value";

function send()
{
oXMLRequest.Open("POST", sURL, true);
oXMLRequest.setRequestHeader("Content-type",
"application/x-www-form-urlencoded");
oXMLRequest.onreadystatechange=sendHandler;
oXMLRequest.Send(sParams );
}

function sendHandler()
{
alert(oXMLRequest.readyState);
}
---------

The point is, destination page is doing redirect sending back '302
Moved Temporarily' status.
Above code runs well if redirection is made to the same host as
specified in 'sURL' variable.
But in case target for the redirection is different, status number '4'
is never displayed.
Statuses 1, 2 and 3 are displayed in both cases.

Below is listening in case the code works:

---------
POST /page.jsp HTTP/1.0
Accept: */*
Accept-Language: pl
Referer: app.hta
Content-Type: application/x-www-form-urlencoded
Connection: Close
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET
CLR 1.1.4322)
Host: www.url.com
Content-Length: xx
Pragma: no-cache

Data found after header end:

param1=value


HTTP/1.1 302 Moved Temporarily
Server: Netscape-Enterprise/4.1
Date: Tue, 23 Nov 2004 20:18:39 GMT
Location: http://www.url.com/log.jsp?error=2
Content-length: 0
Content-Type: text/vnd.wap.wml
Info: Manualy changed
Connection: close



GET /log.jsp?error=2 HTTP/1.0
Accept: */*
Accept-Language: pl
Referer: app.hta
Content-Type: application/x-www-form-urlencoded
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET
CLR 1.1.4322)
Host: www.url.com
Connection: Close


HTTP/1.1 200 OK
Server: Netscape-Enterprise/4.1
Date: Tue, 23 Nov 2004 20:18:40 GMT
Content-Type: text/html; charset=iso-8859-2
Set-Cookie: JSESSIONID=Bjbg8YrHXDpvPhJs1M18PVj59sn2kSvLBSly7ae GZqokoHEfe4G1!1374542120!-1062708702!7001!-1;
path=/
Connection: close

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
....
---------


and here it does not:


---------
POST /page.jsp HTTP/1.0
Accept: */*
Accept-Language: pl
Referer: app.hta
Content-Type: application/x-www-form-urlencoded
Connection: Close
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET
CLR 1.1.4322)
Host: www.url.com
Content-Length: xx
Pragma: no-cache

Data found after header end:

param1=value


HTTP/1.1 302 Moved Temporarily
Server: Netscape-Enterprise/4.1
Date: Tue, 23 Nov 2004 20:21:41 GMT
Location: http://www.new_url.com/log.jsp?error=2
Content-length: 0
Content-Type: text/vnd.wap.wml
Info: Manualy changed
Connection: close



GET /log.jsp?error=2 HTTP/1.0
Accept: */*
Accept-Language: pl
Referer: app.hta
Content-Type: application/x-www-form-urlencoded
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET
CLR 1.1.4322)
Host: www.new_url.com
Connection: Close


HTTP/1.1 200 OK
Date: Tue, 23 Nov 2004 20:21:42 GMT
Server: Apache/1.3.33 (Unix) mod_ssl/2.8.22 OpenSSL/0.9.7e
Connection: close
Content-Type: text/html; charset=iso-8859-1

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
....
---------


Any help would be appreciated?

Greetings,
Rob
 
Reply With Quote
 
 
 
 
Bradley Baumann
Guest
Posts: n/a
 
      12-19-2004
Seems to be something server-side. I don't see anything wrong with your
JavaScript code.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
XMLHTTP response is not returning anything. Please help! pbd22 Javascript 4 03-06-2008 06:50 PM
Msxml*.XMLHTTP vs. Microsoft.XMLHTTP yawnmoth Javascript 11 11-09-2006 08:44 PM
Integrated Security problem on XMLHTTP Request - Finaly IE Crash damianarielfernandez@gmail.com ASP .Net 0 10-19-2006 11:18 AM
MSXML2.XMLHTTP and HttpHandler URL case problem Paul ASP .Net 0 11-10-2003 01:33 PM
please help... ...me learn C++ please please please :) KK C++ 2 10-14-2003 02:08 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57