How to assign values to external variables in ajax Asynchronous callback function
This article introduces the knowledge of "how to assign values to external variables in the ajax asynchronous callback function". In the operation of actual cases, many people will encounter this dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
The copy code is as follows:
$(function () {var str = "aaa"; $.post ("http://localhost/UIBMSPHPProj/index.php/Index/abc",{},function(data){ / / data =" bbb "; console.log (str); / / aaa str = data; console.log (str); / /" bbb "}); console.log (str); / /" aaa "})
This is the end of "how to assign values to external variables in the ajax Asynchronous callback function". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!