473,397 Members | 1,949 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,397 software developers and data experts.

ajax & oo javascript / onreadystatechange problem

hi
i'm struggling with integration of a js class aimed for ajax handling
with fireing actions from the class. here's my code sample:

function AjaxLibLoad(httpActionParam, targetLayerParam){
this.targetLayer = targetLayerParam;
this.httpAction = httpActionParam;
this.httpRequest = this.httpRequestInstance();
this.load();
};

AjaxLibLoad.prototype.load = function() {
this.httpRequest.open('get', this.httpAction);
this.httpRequest.onreadystatechange = this.action; <--here's a
problem
this.httpRequest.send(null);
};

AjaxLibLoad.prototype.action = function() {
alert('test' + this.httpRequest);
if (this.httpRequest.readyState == 4) {
if (this.httpRequest.status == 200) {

this.userAction();
} else {
alert('error');
}
} else {
return false;
}
}

AjaxLibLoad.prototype.userAction = function() {
document.getElementById(this.targetLayer).innerHTM L =
this.httpRequest.responseText;
autoInit_trees();
};

sooo what happens
ajax starts well, but alert('test' + this.httpRequest); gives me 'test
[HttpXML...]' only for the first time (action is fired 4 times)

so what for is oo ajax ?? i'm trying to write application that lunch
many ajax instances at the same time, so each one have to run on it's
own httpRequest object to avoid freezing (tha happend when i used one
global instance of httpRequest)

it's interesting issue. it would be great to solve it
thank for Your help

Apr 14 '06 #1
1 1818
VK

va*****@gmail.com wrote:
i'm trying to write application that lunch
many ajax instances at the same time, so each one have to run on it's
own httpRequest object to avoid freezing (tha happend when i used one
global instance of httpRequest)


<http://www.ajaxtoolbox.com>

Apr 15 '06 #2

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

Similar topics

3
by: Ivan P | last post by:
Hello! I have a index.php that on one click calls via AJAX a file.php. index.php looks like this: <html > <head> <script language="javascript" type="text/javascript" >
17
by: Arjen | last post by:
Hi, I want to reload 2 divs at one click. Ive tried: <a href = "javascript:void(0);"...
4
by: UKuser | last post by:
Hi, I'm working on the following code, which works fine in Firefox, but not in IE. The problem is its not posting the variable to my page and I'm thinking its something wrong with the...
2
by: Nathan Sokalski | last post by:
I am moving my website from my machine to my webhost, and need some help with what extra files I need to include due to the fact that I used AJAX in my site. Everything on the site is obviously...
0
by: Tarik Monem | last post by:
I have been working on an all AJAX/DOM web site which is set to go live today and I thought I'd share my discoveries with all of you whom have helped me when I have encountered different issues along...
2
by: shivendravikramsingh | last post by:
hi friends, i m using a ajax function for retrieving some values from a database table,and display the values in required field,my prob is that the ajax function i m using is working f9 once,but if...
4
by: slebetman | last post by:
On Jun 5, 9:36 pm, sheldonlg <sheldonlgwrote: You can of course use closure to pass the required parameter: var hideIt; // the variable you wish to pass ajax.onreadystatechange = function () {...
22
by: sheldonlg | last post by:
I am looking for a clean solution to a problem that I solved in, what I call, a "dirty" way. Here is what I want to do. I have a dropdown list. Clicking on an item in the dropdown list invokes...
1
by: fidgen | last post by:
Hiya, I'm trying to get a AJAX driven update to my list of news articles, so when users click the title of the news article, it pops up the article content in a thickbox overlay. Retrieving...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
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...

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.