473,398 Members | 2,389 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,398 software developers and data experts.

onreadystatechange in object

Anyone know how to let processReqChange know that it is in an object?
In Php I can do it like this: array($this, 'function_name');

Any idea for a workaround?

/Jacob

function ajax () {

this.url = '';

this.getXML = getXML;
this.processReqChange = processReqChange;

function getXML () {
if (window.XMLHttpRequest) {
this.req = new XMLHttpRequest();
this.req.onreadystatechange = this.processReqChange;
this.req.open('GET', this.url, true);
this.req.send(null);
} else if (window.ActiveXObject) {
this.req = new ActiveXObject('Microsoft.XMLHTTP');
if (this.req) {
this.req.onreadystatechange = this.processReqChange;
this.req.open('GET', this.url, true);
this.req.send();
}
}
}

function processReqChange () {
if (this.req.readyState == 4) {
if (this.req.status == 200) {
alert('ok');
} else {
alert('There was a problem retrieving the XML data:' +
this.req.statusText);
}
}
}

}

Jul 23 '05 #1
1 2035
If "XmlHTTPRequest.open automatically aborts any current requests" is
true, then I guess there's no idea in creating an object?
http://www.codeproject.com/aspnet/AJAXWasHere-Part1.asp

Jul 23 '05 #2

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

Similar topics

6
by: Krzysztof Kubiak | last post by:
I'm trying to make use of XMLHTTP object, but I've come across a problem. It seems that there is no way to create dynamic array of such XMLHTTP objects (to make several requests) and handle them...
1
by: shlomi.schwartz | last post by:
Hi All I Tried everything, How can I catch Flash Player OnReadyStateChange event using Javascript? I tried:
1
by: akhil.patel | last post by:
I realize that this may have been asked before, but I could not find a definitive answer. function loadXMLDoc(url, MyFunction) { // use native XMLHttpRequest object if (window.XMLHttpRequest)...
2
by: Dustin | last post by:
I found a solution to my problem in the topic called "OOP (and the XMLHttpRequest)". You may find it useful to reference to see what I have done so far. I am making a small AJAX helper object...
1
by: weston | last post by:
So, the following apparently works as a method of grafting a method onto an object (using the squarefree JS shell): obj = { x: 1, inc: null } result obj.inc = function () { this.x++ } result...
3
by: Daz | last post by:
Hi all. I would like to take the onreadystatechange method, and make it private. Please could someone tell me what I need to do? I am guessing I'd need to somehow copy the constructor of the...
1
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...
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
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
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
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,...
0
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...

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.