Advertisement

05.01.2008 at 02:05PM PDT, ID: 23370103
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

Javascript AJAX multiple calls

Zone: JavaScript
Tags: javascript, javascript, any
I have the code to do an ajax call isolated in a function. When I call it multiple times, in some instances, it will return what ever was in the call of the last call.
Please show me how to code this so this does not happen while keeping it a called function.
Here is the code:
function doajax(arg,descs){
  var DATETIME = new Date().getTime();
  arg = arg+'&DATETIME='+DATETIME
  if (window.XMLHttpRequest) objHTTP = new XMLHttpRequest();
  else if (window.ActiveXObject) {
   try {
    objHTTP = new ActiveXObject("Msxml2.XMLHTTP")
   } catch(e) {
    try {
     objHTTP = new ActiveXObject("Microsoft.XMLHTTP")
    } catch(e) {}
   }
  }
  else return;
  objHTTP.onreadystatechange = function() {
   if(objHTTP.readyState == 4){
    var tvar = objHTTP.responseText.substring(objHTTP.responseText.indexOf('<HTML>')+6,objHTTP.responseText.indexOf('</HTML>'));
    var tarr = tvar.split('(*~$)');
    var descsarray = descs.split(',');  
    for (i=0;i<descsarray.length;i++){document.getElementById(descsarray[i]).innerHTML = tarr[i];}
   }
  };
  objHTTP.open("GET", arg, true);
  objHTTP.send('');
  return;
}

If I call it like this, it works fine:
function callmultiple{
arg = 'http://whatever.com/cgi/prog.pl?program=test&div=div1&div=div2';
descs = 'div1,div2';
doajax(arg,descs);
return
}

The above was my workaround, here is my original code:
function callmultiple{
arg = 'http://whatever.com/cgi/prog.pl?program=test&div=div1';
descs = 'div1';
doajax(arg,descs);
arg = 'http://whatever.com/cgi/prog.pl?program=test&div=div2';
descs = 'div2';
doajax(arg,descs);
return
}

Please do not check the syntax of the calling functions as they are just samples.
I am sure there is a timing issue with calling the doajax twice in a row as it does not wait to call it a second time. I do not know how to avaoid this.

Thanks in advance for your help, Troy
Start your free trial to view this solution
Question Stats
Zone: Programming
Question Asked By: troyd1
Solution Provided By: cwolves
Participating Experts: 2
Solution Grade: A
Views: 0
Translate:
Loading Advertisement...
05.01.2008 at 06:18PM PDT, ID: 21483963

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.02.2008 at 04:02PM PDT, ID: 21490546

Rank: Master

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.04.2008 at 04:18AM PDT, ID: 21495361

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.04.2008 at 10:52AM PDT, ID: 21496366

Rank: Master

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.04.2008 at 04:08PM PDT, ID: 21497297

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.04.2008 at 04:28PM PDT, ID: 21497370

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
20080236-EE-VQP-29 / EE_QW_2_20070628