472,989 Members | 3,053 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,989 software developers and data experts.

Problem with XMLHTTP request. Please help! (long)

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
Jul 23 '05 #1
1 2056
Seems to be something server-side. I don't see anything wrong with your
JavaScript code.

Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Irene | last post by:
Hi, I have an asp page that allows a user to search for info in a DB and add info to a DB. The search uses "ADODB.Connection" objects in the page, but the add will use a call to an isapi dll...
1
by: Alex Li | last post by:
Dear js/xmlhttp experts, I spent hours but could not solve this problem and hope someone could give me a clue: a onclick event will invoke a function to do a few things: 1. make a hidden DIV...
3
by: Mark | last post by:
Hi all i was just wondering if you help. I have to send a cgi request to a company using xmlhttp request. They reply back with a line of info but when you view the internet explorer source code...
3
by: lodge.stuart | last post by:
Hi I've written a small AJAX-style UI - although it's not strictly AJAX as it uses HTML fragments rather than XML This UI works fine for me and the majority of users. However, a few users...
0
by: damianarielfernandez | last post by:
Hi Group, I've a problem when I call via Ajaxs a page that is on Integrated Security. The result come back but if i sniff with Fiddler the calls to my server for my surprise have two, one came back...
0
by: wasif | last post by:
I am trying to upload file using ajax and php but having some problems. it always says that there was a problem and file is not uploaded. here is the code form and ajax code <!DOCTYPE html...
6
by: Harshpandya | last post by:
HI all, I am working on the Ajax and PHP to make dynamic web page application I have HTML page - in which i am calling two different pages Google and NBC from Drop down menu. OUTPUT WANTED:...
4
by: Harshpandya | last post by:
HI all, I am working on the Ajax and PHP to make dynamic web page application I have HTML page - in which i am calling two different pages Google and NBC from Drop down menu. OUTPUT WANTED:...
47
by: mukeshrasm | last post by:
Hi I am calling two pages using Ajax Get_Pages.php and Get_Content.php from combo box. Both pages are displayed based on selection from combo box. Main problem is that it is not showing the...
1
by: harikumarmpl | last post by:
Hi to all Here i have a problem, I have a search form in that one which is for searching the usernames in the database It works fine when i search the UserNames at first time. When i have...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...
3
SueHopson
by: SueHopson | last post by:
Hi All, I'm trying to create a single code (run off a button that calls the Private Sub) for our parts list report that will allow the user to filter by either/both PartVendor and PartType. On...

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.