get returned values from jquery get?

前端 未结 3 1485
时光取名叫无心
时光取名叫无心 2021-01-07 10:27

I am making jquery calls to get and getJSON, but cannot access returned values outside of callback function. How can I access the returned data?

        var          


        
3条回答
  •  心在旅途
    2021-01-07 11:17

    This is because it is done asynchronous (one of the basic principles of AJAX). You can set async to false or use some other callback construction to use your value returned from the get call.

提交回复
热议问题