Two ajax requests on same event at same time . what should be the typical behaviour? how it is different if request is synchronous

后端 未结 4 2043
轻奢々
轻奢々 2020-12-31 20:40

In the following javascript code, I am sending two Ajax request at the same time.
After analysis using Firebug, I came to unusual conclusion that :
\"which ever

4条回答
  •  独厮守ぢ
    2020-12-31 21:04

    Or use server_response in your code. The script begin with condition:

    if (recherche1.length>1) {
        $.ajax({ // First Request
            type :"GET",
            url : "result.php",
            data: data,     
            cache: false,
            success: function(server_response){     
                $('.price1').html(server_response).show();                  
            }           
        }),
    
        $.ajax({ //Seconds Request
            type :"GET",
            url : "result2.php",
            data: data,     
            cache: false,
            success: function(server_response){                          
                $('.price2').html(server_response).show();      
            }           
        });
    }
    

提交回复
热议问题