Javascript Ajax-JQuery,数组到查询字符串

Javascript Ajax-JQuery,数组到查询字符串,javascript,arrays,jquery,Javascript,Arrays,Jquery,我尝试使用JQuery通过Ajax发送JavaScript数组对象。我读到的所有内容都指向使用JSON数组,难道不能使用标准数组吗 例如: var data = new Array; data['type'] = 'author_list'; data['limit'] = 10; $.ajax( { url : '/transporter.php/', dataType : 'json', data :

我尝试使用JQuery通过Ajax发送JavaScript数组对象。我读到的所有内容都指向使用JSON数组,难道不能使用标准数组吗

例如:

   var data = new Array;
   data['type']  = 'author_list';
   data['limit'] = 10;

   $.ajax(
   {
      url      : '/transporter.php/',
      dataType : 'json',
      data     :  data,
      type     :  'GET',
      success  : function(json) 
      {
         console.log(json);
      }
   });
这个方法是我在使用DOJO时使用的。我希望JQuery也是如此


谢谢,

您想使用对象而不是数组:

  var data = {};
   data['type']  = 'author_list';
   data['limit'] = 10;

   $.ajax(
   {
      url      : '/transporter.php/',
      dataType : 'json',
      data     :  data,
      type     :  'GET',
      success  : function(json) 
      {
         console.log(json);
      }
   });

此外,JSON是您请求的页面将返回的内容,而不是发送到该页面的内容。JSON是对象的字符串表示形式,您将实际对象传递给
ajax
方法。

您希望使用对象而不是数组:

  var data = {};
   data['type']  = 'author_list';
   data['limit'] = 10;

   $.ajax(
   {
      url      : '/transporter.php/',
      dataType : 'json',
      data     :  data,
      type     :  'GET',
      success  : function(json) 
      {
         console.log(json);
      }
   });
此外,JSON是您请求的页面将返回的内容,而不是发送到该页面的内容。JSON是对象的字符串表示形式,您正在将实际对象传递给
ajax
方法