473,583 Members | 3,134 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

After making a AJAX request from .js file the readystate propertyof the Http object is not changing (remains constantly @ 1)

Hello,

Once the AJAX request is fired the readystate property remain as 1. It
never gets changed and the callback method is not firing as a result the
..aspx page is not being rendered.

The two functions that is involved in the above mentioned issues are
placed below:

fn #1

function ajax_SendReques t(fullUrl, callback)
{
var xmlHttp = CreateXmlHttpOb ject();

var url = fullUrl.split(' ?')[0];
var params = fullUrl.split(' ?')[1];

//Use post method in case data send to server exceed limit.
xmlHttp.open("P OST", url, /* async = */ true);
xmlHttp.onready statechange = function() {
_ajax_HandleRes ponse(xmlHttp, callback); setCursorToArro w();}

xmlHttp.setRequ estHeader("Cont ent-type",
"applicatio n/x-www-form-urlencoded");
xmlHttp.setRequ estHeader("Cont ent-length", params.length);
xmlHttp.setRequ estHeader("Conn ection", "close");

if (currentXmlHttp != null)
{
pendingRequests .push(xmlHttp);
pendingRequests Content.push(pa rams);
}
else
{
currentXmlHttp = xmlHttp;
xmlHttp.send(pa rams);
}
}

fn #2

function _ajax_HandleRes ponse(xmlHttp, callback)
{

if (xmlHttp.readyS tate != 4)
{
// Not finished yet; do nothing
}
else if (xmlHttp.status != 200)
{
if( xmlHttp.status != 0 ) // Not aborted
{
_ajax_ReportErr or("AJAX request failed with HTTP code " +
xmlHttp.status + " : " + xmlHttp.statusT ext);
}
}
else
{
var dom = xmlHttp.respons eXml;
var err = dom.parseError;

if (err.errorCode != 0)
{
_ajax_ReportErr or(err.reason + "\nXML context: " +
_ajax_FocusSubS tring(err.srcTe xt, err.linepos));
}
else
{
var root = xmlHttp.respons eXML.selectSing leNode("root");

if (! root)
{
_ajax_ReportErr or("XML was valid but did not have the expected
'root' document element");
}
else
{
_ajax_UnpackRes ponse(root);
if(root.selectS ingleNode('cont ent') &&
root.selectSing leNode('content ').attributes.g etNamedItem('Er rorCode'))
callback = null;

if (callback)
{
callback(root);
}

var fn = document.body.o nresize; // Yes, we have to alias this.
No, we don't know why.
if (fn) fn();
}
}
}
if (pendingRequest s.length 0)
{
currentXmlHttp = pendingRequests .shift();
currentXmlHttp. send(pendingReq uestsContent.sh ift());
}
else
{
currentXmlHttp = null;
}
}
Thanks,
Mathan.
Sep 19 '06 #1
0 1711

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

Similar topics

3
10414
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 are finding it doesn't work at all. I've talked with these users and debugged it a little by adding some
9
15065
by: Eric Wallstedt | last post by:
I have a page that "logs" changes made to input fields using ajax to pass data to a cgi. I use POST and it works fine most of the time (all the time in IE). But it fails when I get the data from a popup that invokes a function that in turn invokes ajax. Scenerio 1. user clicks a button to create a popup 2. the user selects a select...
6
2527
by: Nico VanHaaster | last post by:
Hello all, I have run across an issue with IE 6.0+. I have a page that makes an XMLHttpRequest to the webserver to update a report on the page. The first time you hit the refresh report button the data is refreshed, however if you try to refresh the report the onreadystatechage does not seem to fire. I have tested this by placing an alert...
17
11854
by: Arjen | last post by:
Hi, I want to reload 2 divs at one click. Ive tried: <a href = "javascript:void(0);" onclick="show('ajaxrequest.php?action=removefield','div1');show('ajaxrequest.php?action=reloaddiv2','div2')">verwijderen</a> While both seperate actions work they dont when I put them together. Anyone know how to fix this ? My ajax.js with funcition...
1
8365
nmm32
by: nmm32 | last post by:
I am trying to use Ajax with JSP to populate a 2nd drop down list based on the chosen option of the first one. I am getting the error "Object Expected" on the line 13-14 of the HTML: <script language="javascript"> // Global Variable for XmlHttp Request Object var xmlhttp; var yearDDL; function handleOnChangepType(ddl) {
2
1323
by: rpollard | last post by:
Hi, I am relatively new to Ajax and am wondering if someone can shed a bit of light on the conceptual part of how Ajax handles its communication. Not knowing a whole lot about Ajax when I started coding I copied some code from the Internet that seem to be the accepted way of creating the object and using it. This is the code I am using on...
1
5252
by: bgold12 | last post by:
I have a page that calls a javascript function every second using setInterval(): ... <body onload="setInterval('UpdateMessages(1);', 1000 );"> ... In UpdateMessages(), I create an AJAX XMLHttpRequest object and send the request (with open() and send()), and I make sure to set the onreadystatechange function.
0
7896
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8328
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
8195
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6581
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5701
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3820
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3845
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2334
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1434
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.