how to find the in progress AJAX request.

Discussion in 'PHP' started by vetrivel, Oct 23, 2009.

  1. #1
    Hi,
    I am calling Ajax number of times.and finally i will submit the form.

    Now before submitting the form ,I need to check whether all the ajax call is completed.
    How to do this?
    I need to submit the form only after completing all the IN progress request .
     
    vetrivel, Oct 23, 2009 IP
  2. mastermunj

    mastermunj Well-Known Member

    Messages:
    687
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    110
    #2
    you can check value of readyState property:

    0 The request is not initialized
    1 The request has been set up
    2 The request has been sent
    3 The request is in process
    4 The request is complete

    For further details, check this simple tutorial..

    http://www.w3schools.com/Ajax/ajax_xmlhttprequest.asp
     
    mastermunj, Oct 23, 2009 IP
  3. vetrivel

    vetrivel Peon

    Messages:
    147
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I am calling multiple ajax script
    So each one have different status .
    I need to check globally all the ajax calls outside the function.

    I am checking the status as you said inside each function but i need to do it globally outside the funstion.
     
    vetrivel, Oct 23, 2009 IP
  4. mastermunj

    mastermunj Well-Known Member

    Messages:
    687
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    110
    #4
    for multiple ajax you would be making multiple ajax objects as well. put them all in array and create a function which checks each ajax object inside array for request status. if any of them has in-progress status, it can return false else true :)
     
    mastermunj, Oct 23, 2009 IP