Parallel Ajax Calls in Javascript/jQuery

前端 未结 9 1675
感情败类
感情败类 2021-02-07 17:18

I am completely new to Javascript/jquery world and need some help. Right now, I am writing one html page where I have to make 5 different Ajax calls to get the data to plot grap

9条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-07 18:00

    In jQuery.ajax you should provide a callback method as below:

    j.ajax({
            url : url0,
            async : true,
            dataType : 'json',
            success:function(data){
                 console.log(data);
            }
        }
    

    or you can directly use

    jQuery.getJSON(url0, function(data){
      console.log(data);
    });
    

    reference

提交回复
热议问题