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

前端 未结 5 2106
走了就别回头了
走了就别回头了 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:27

    Could try:

    function getResults(locationType) {
        $.getJSON(url, {p1:'xxx', p2: 'yyy'}, function(results) {
            searchResults(results, locationType)
        });
    }
    

提交回复
热议问题