How can I pass parameters to a jQuery $.getJSON callback method?

前端 未结 5 2136
走了就别回头了
走了就别回头了 2020-12-29 23:50

I\'m trying to use jQuery to call some custom API via Ajax/$.getJSON.

I\'m trying to pass a custom value into the Ajax callback method, but that value

5条回答
  •  盖世英雄少女心
    2020-12-30 00:24

    If you want to use locationType (whose value is 3) in the callback, simply use

    function(results) { .....
    

    thanks to closures, locationType will be automatically available in the callback.

提交回复
热议问题