Jump to content

running several instances of an ajax function concurrently


aooga

Recommended Posts

I have a function -->

function edituserquestion(questionid, action) {

  xmlHttp=GetXmlHttpObject();if (xmlHttp==null){alert ("Browser does not support HTTP Request");return;}

  ...}

which calls -->

function stateChangededituserquestion() {...}

How can I make it that if the user clicks one a button with questionid 5, and before stateChangededituserquestion returns from the server the user clicks on another button with a different questionid, it'll work fine (i.e. the server will process one after the other and my script will deal with them in order?)

Ok I learnt some jQuery, I don't know if it helped.

Here's my function:

function edituserquestion(questionid, action) {

$.post(

"index_edituserquestion.php",

{questionid: questionid, action: action},

function(xml) {

qid = $("questionid", xml).text();

questiontype = $("questiontype", xml).text();

fedituserquestion(qid, questiontype);

refreshnreviewnow();

refreshreviewquestions();

}

);

}

 

So when I click one one question, calling edituserquestion(30), and quickly click on edituserquestion(20), only edituserquestion(20)'s response is registered.

 

I don't know how to convert this to use global variables. What should I do?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.