Do not know the role of this parameter before, the Internet to find the predecessor of the blog, in this collection to their own blog, hoping to help more friends:
Test.html
<a href= "javascript:void (0)" onmouseover= "Testasync ()" >
Asy.js
function testasync{
var temp;
$.ajax ({
async:false,
type: "Get",
URL: ' tet.php ',
complete:function (msg) {
alert (' Complete ') ;
},
success:function (data) {
alert (' success ');
Temp=data;
}
});
Alert (temp+ ' End ');
}
tet.php
<?php
echo "Here is HTML code";
Sleep (5);
? >
Async:false, (default is True);
As above: False for synchronization, the AJAX request in this Testasync () method locks the entire browser to death,
You can perform other actions only after tet.php execution has finished.
When Async:true, the AJAX request is asynchronous. But one of the problems: the AJAX request in Testasync () and its subsequent operations are performed asynchronously, so that when the tet.php is not finished, the operation behind the AJAX request may have been performed.
such as: alert (temp+ ' end ');
However, the temp data is only assigned after the AJAX request success, and the output is empty.
This article on jquery in the Ajax asynchronous request async parameters of the role is to share all the content of the small, hope to give you a reference, but also hope that we support the cloud habitat community.