jQuery. Assign JSON as a result to a variable

前端 未结 3 1190
走了就别回头了
走了就别回头了 2020-12-21 16:16

I use this helper function to receive JSON results for my requests:

function getData(url) {
    $.get(url,
         function(data) {
             response =          


        
3条回答
  •  被撕碎了的回忆
    2020-12-21 16:41

    Use $.ajax

    $.ajax({
        url: 'http://www.example.com',
        dataType: 'json',
        success: function(data){
           alert(data.Id);
        }
    });
    

提交回复
热议问题