| Author |
dynamic xmlhttp page
|
Tien-Chih Wang
Greenhorn
Joined: Feb 23, 2003
Posts: 25
|
|
Hi, I trigger two xmlhttp connection simultaneously. What I need is to keep one xmlhttp.responseText as static InnerHtml and still updating the other(Using setTimeout()). The page only displays the setTimeout() one but never shows the first static one. Is there anyway to do this? Sample codes provided will be appreciated. Regards, Tien-Chih Wang
|
 |
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15357
|
|
What is the code that you are using? Eric
|
 |
Tien-Chih Wang
Greenhorn
Joined: Feb 23, 2003
Posts: 25
|
|
Hi, here is the xmlhttp javascript source code. The 'count' element keeps counting without any problem, but the 'record' element never show up. --------------------------------------------------------------------------- <script language="javascript"> <!-- function count() { req = new ActiveXObject("Microsoft.XMLHTTP"); req.open("get", "counter.cgi", true); req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); req.onreadystatechange= function() { if (req.readyState==4) { if (req.status==200) { window.document.getElementById('count').innerHTML=req.responseText; } } }; req.send(); setTimeout("count()",500); } function call() { req = new ActiveXObject("Microsoft.XMLHTTP"); req.open("get", "jobHandling.cgi", true); req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); req.onreadystatechange= function() { if (req.readyState==4) { window.document.getElementById('record').innerHTML=req.responseText; } }; req.send(); count(); } --------------------------- Html code <table> <tr><td><div id='count'></div></td></tr> // Display ok <tr><td><div id='record'></div></td></tr> // Show Nothing..:-( Regards, Tien-Chih Wang
|
 |
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15357
|
|
I glanced at it in a split second and you are using two global variables named req. if you do not declare var req inside your function, it is global. Try declaring it and see if you still have problems. I did not look at the code other than that right now. Eric
|
 |
Tien-Chih Wang
Greenhorn
Joined: Feb 23, 2003
Posts: 25
|
|
Hi, Thanks for the help!! Indeed it's a global variable issue. Take a look at this site to see the result. http://www.onsofts.com/deepJobSearch.jsp Sincerely, Tien-Chih Wang
|
 |
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15357
|
|
Glad I could help. Eric
|
 |
Tien-Chih Wang
Greenhorn
Joined: Feb 23, 2003
Posts: 25
|
|
Originally posted by Tien-Chih Wang: Hi, Thanks for the help!! Indeed it's a global variable issue. Sincerely, Tien-Chih Wang
|
 |
 |
|
|
subject: dynamic xmlhttp page
|
|
|