i am not sure if this is the right way to use this AJAX script i did!
i want to know i f it will be compatible with IE 6 also!!
thanx!
9 2054
What exactly is the code supposed to be doing? Why do you have 5 or so Ajax calls?
i got a table with results from the data base ,this table i s updating every 4
seconds ,the other calls are some limitations i put in the table ,there is two limitations ! ,this code i s working on my auction site ,there is one more call to check when to close the auction!
what i did there is to update the first call ,and if some thing as change, call the
other calls to check if everything is all right!
thats it :)
all the calls are working ,some times i got some call that is not working ,what im thinking is that the there is some problem with older browsers .
my question is if there is something wrong with my code! ,im not expert :)
thanx
can someone look at the code and tell me please if it's the right way?
do i need to make new getXMLhttp request to each call ,or there is a way to use one xmlhttp for all the call requests?
i used xmlhttp1 , xmlhttp2.....
thanx
I think it shouldn’t be a problem to use only one request object, but how do you tell it, which response function to use?
the other response i did is to just fire the php file , the first request is checking
for changes in the database ,and if there is a change ,it is fireing the others - function HandleResponse(res)
-
{
-
if (document.getElementById('id').innerHTML == res)
-
{}
-
else if (document.getElementById('id').innerHTML = res)
-
{
-
MakeRequest();MakeRequest4();MakeRequest5();Audio();
-
}
-
else
-
{}
-
}
is this the right way :) ?
does look troublesome. you’ll probably get into an infinite loop.
further is if (element.innerHTML = res) intended? (if (res) seems better)
from what you see ,there is only one code that is looping every 4 seconds no? - function MakeRequest2()
-
{
-
var xmlHttp = getXMLHttp();
-
-
xmlHttp.onreadystatechange = function()
-
{
-
if(xmlHttp.readyState == 4)
-
{
-
HandleResponse(xmlHttp.responseText);
-
}
-
}
-
nocache = Math.random();
-
xmlHttp.open("GET", "check2.php?bid_id="+bid_id+'&nocache = '+nocache);
-
xmlHttp.send(null);
-
setTimeout('MakeRequest2()', 4000);
-
}
this file check2.php is a small file 124 bytes ,and it's checking in the database for changes ,if there is a change ,then fireing the other requests!
@canabatz
if you have only one XHR object and you call within the responsehandler this object again to make a new request, then you will trigger new requests each time the previous request completed.
PS - setTimeout(MakeRequest2, 4000);
so ,the way i have it ,it should be like that?
Sign in to post your reply or Sign up for a free account.
Similar topics
by: James Cameron |
last post by:
Hi I'm developing a program and the client is worried about future
reuse of the code. Say 5, 10, 15 years down the road. This will be a
major factor in selecting the development language. Any...
|
by: Cardman |
last post by:
Greetings,
I am trying to solve a problem that has been inflicting my self
created Order Forms for a long time, where the problem is that as I
cannot reproduce this error myself, then it is...
|
by: Steven T. Hatton |
last post by:
Some people have suggested the desire for code completion and refined
edit-time error detection are an indication of incompetence on the part of
the programmer who wants such features. ...
|
by: Kenton Groombridge |
last post by:
Hi,
I previous posted this in a gcc and g++ groups since that is the
compiler I am working with, but I didn't get any response.
Hopefully these are the right groups for this question. I am...
|
by: Steph |
last post by:
Hi.
I'm very new to MS Access and have been presented with an Access database
of contacts by my employer.
I am trying to redesign the main form of the database so that a button
entitled...
|
by: Dixie |
last post by:
Can I set the Format property in a date/time field in code?
Can I set the Input Mask in a date/time field in code?
Can I set the Format of a Yes/No field to Checkbox in code?
I am working on...
|
by: tshad |
last post by:
I am just trying to decide whether to split my code and uses code behind. I
did it with one of my pages and found it was quite a bit of trouble.
I know that most people (and books and articles)...
|
by: Swaregirl |
last post by:
Hello,
I would like to build a website using ASP.NET. I would like website
visitors to be able to download code that I would like to make available to
them and that would be residing on my...
|
by: TPJ |
last post by:
Help me please, because I really don't get it. I think it's some stupid
mistake I make, but I just can't find it. I have been thinking about it
for three days so far and I still haven't found any...
|
by: robert maas, see http://tinyurl.com/uh3t |
last post by:
I'm working on examples of programming in several languages, all
(except PHP) running under CGI so that I can show both the source
files and the actually running of the examples online. The first...
|
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
|
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...
|
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...
|
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,...
|
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,...
|
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...
|
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: 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,...
|
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...
| | |