Ajax-网址参数与数据

In JQuery Ajax calls, which of the below is recommended? I know both are similar but is there an obvious advantage between these two?

Ajax call with URL Paramater.

$.ajax({
url: 'test.php?uAction=action&uType=type',
    dataType: 'json',
    success: function(data, status){
            $.each(data, function(i,item){
                });
            },
    error: function(){
            output.text('There was an error loading the data.');
        }
    });

or Ajax call with parameter arranged in object

$.ajax({
    url: 'test.php',
    dataType: 'json',
    data: {
        uAction: 'action',
        uType: 'type'
    },
    success: function(data, status){
            $.each(data, function(i,item){

                });
            },
    error: function(){
            output.text('There was an error loading the data.');
        }
    });
查看全部
weixin_33749242
weixin_33749242
2016/07/27 05:53
  • ajax
  • jquery
  • 点赞
  • 收藏
  • 回答
    私信

1个回复