Ordering of asynchronous javascript events

前端 未结 3 1453
没有蜡笔的小新
没有蜡笔的小新 2021-01-22 11:47

I have the following code:

$(\"#submit_financials\").live(\'click\', function(event){
    event.preventDefault();

    // using serialize here to pass the POST v         


        
3条回答
  •  Happy的楠姐
    2021-01-22 12:31

    option 1 is to nest the post requests (gdoron's response). If this is not possible/practical, you can use a mutually scoped variable as a flag (change value in the response callback functions and then use setTimeout and recursion (or setInterval) to keep looking for a change in your "flag" variable and when you see it change, then pop the next $.post request

提交回复
热议问题