Copy codeThe Code is as follows:
$ (Document). ready (function (){
$ ('# Getsetgo'). click (function (){
$. When ($. ajax ("page1.php"), $. ajax ("page2.php"). done (function (a1, a2 ){
Certificate ('incluid1'0000.html (a1 [0]);
Certificate ('shortid2'short.html (a2 [0]);
});
});
});
After jquery 1.5 is released, the newly added method jQuery. when () can process multiple ajax requests at a time. For more details, see the jquery api documentation.
Collection by Ancker
Jquery another method for processing multiple ajax requests on the same page
Add a parameter
Copy codeThe Code is as follows:
$. Post (
"Dow.hfile. aspx ",
{
Type: '1'
},
Function (data, textStatus)
{
},
"Json ");
$. Post (
"Dow.hfile. aspx ",
{
Type: '2'
},
Function (data, textStatus)
{
},
"Json ");
In the dow.hfile. aspx. cs file:
Copy codeThe Code is as follows:
If ((! String. IsNullOrEmpty (Request ["type"]) & (Request ["type"] = "1 "))
{
// Do something
}
If ((! String. IsNullOrEmpty (Request ["type"]) & (Request ["type"] = "2 "))
{
// Do something
}
The different ajax requests can be processed on the same page. You do not need to create a new page for each ajax request.