When ajax is obtained synchronously, ff and ie
1 2 3 <title> Ajax synchronization test </title>
4 <script src = "Scripts/jquery-1.4.1.js" type = "text/javascript"> </script>
5 <script type = "text/javascript">
6 $ (document). ready (AjaxTest );
7 function AjaxTest (){
8 var flag = 0;
9 // display and Load
10 $ ("# ajaxStatus"). text ("loading data please wait .......");
11 // ajax submission (synchronous Mode)
12 $. ajax ({
13 type: "get ",
14 url: "/FunctionPage. aspx ",
15 async: false,
16 cache: false,
17 data :"",
18 dataType: "html ",
19 success: function (ajaxData ){
20 flag = ajaxData;
21 $ ("# ajaxStatus"). text ("Data Loading completed! ");
22}
23 });
24 if (flag = 1 ){
25 // loading is completed
26 $ ("# ajaxStatus"). text ("synchronization Data Loading completed! ");
27}
28}
29 </script>
30 31 <body>
32 <div id = "ajaxStatus"> </div>
33 </body>
34 35
Description: gets the return value of FunctionPage. aspx. If the return value is 1, it indicates that synchronization loading is completed.
Case 1: in ie, the synchronization data loading is completed after the synchronous call is completed. No prompts are displayed during data loading, and ie is suspended.
Case 2: ff is normal. The execution sequence is as follows: Data Loading in progress-> ajax request execution-> Data Loading completed.
Conclusion: The synchronization mode in ie will lead to the assumption that ie is dead. This user experience is quite uncomfortable. I don't know if there is any better solution, so I will implement logic in asynchronous mode for the moment.
Async: true
Test code:/Files/skyangell/AjaxAsyncDemo.rar