In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly shows you "sample analysis of asynchronism and synchronization in Ajax requests". The content is simple and clear. I hope it can help you solve your doubts. Let me lead you to study and learn the article "sample analysis of async and synchronization in Ajax requests".
When I was working on the project, I used a table control whose data was loaded asynchronously. I did some business processing under the function of binding data in this table. When I was running the page, I used the browser to put breakpoint tracking in the place where I wrote the business processing. It did execute. When it was finally displayed, its processing was overwritten. I was very puzzled. At that time, I also knew that there was a problem with this table binding function, but time was tight, and its function was encapsulated. Without specific tracking, I directly let that part of my business process delay the execution of 200ms. This is good, this is a stupid method, but it is also an effective way, hehe.
Later, I looked at the document and looked up some information. In fact, the principle should be like this:
By default, all requests are asynchronous. If you need to send a synchronization request, set this option to false. Note that the synchronization request will lock the browser, and other user actions must wait for the request to complete.
The code is as follows:
Var temp
$.ajax ({
Async: false
Type: "POST"
Url: defaultPostData.url
DataType: 'json'
Success: function (data) {
Temp=data
}
});
Alert (temp)
This ajax request is a synchronous request, and alert (temp) is not executed until there is no return value.
If async is set to: true, the result of the ajax request will not be waited, and the statement that follows the ajax will be executed directly.
The above is all the contents of the article "sample Analysis of asynchronism and synchronization in Ajax requests". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.