Get the App
SLTechnology News&Howtos  ›  Development  › 

How to assign values to external variables in ajax Asynchronous callback function

Shulou Source: shulou.com Published: 2022-06-03 12:36:24 11月15日 Update

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!

Tags: Functions variables code content more knowledge practicality learning and then dilemmas realities situations articles cases editing websites industries processes high quality learning Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL Linux Huawei Shulou Technology MariaDB