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?)

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.