AJAX not updating variable

前端 未结 5 1095
生来不讨喜
生来不讨喜 2020-12-07 02:51

jQuery

I am making an AJAX request that updates the value of a variable (foo) with a response from the server. Here is the code I am using:



        
5条回答
  •  孤街浪徒
    2020-12-07 03:21

    The (first) A in "AJAX" stands for asynchronous. The transaction does not happen immediately, and so your alert() happens quite some time before the remote call completes.

提交回复
热议问题