473,394 Members | 1,854 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,394 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 2081
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...

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.