Passing arrays in ajax call using jQuery 1.4 -


The following code works for me using jQuery 1.2.6 but causes a broker error in 1.4.

  var item = new array (); Items [0] = "item 1"; Items [1] = "item 2"; Item [2] = "item 3"; Var dataToSend = {'_service': myService, '_program': my program, 'selection': item}; $ .AJX ({type: "post", url: myleal, data type: "text", data: datatused, success: function (request) {$ ('# result'). Html (request);} // Success }); // Last AZ method  

I get the error of the broker indicating what is being passed in the selection 'Selection []'

Error:

How to manage the jQuery array in an Ajax call? (Invalid character "[" field name "selection []"). it was done? Or was this the wrong way to pass the array?

Any help would be appreciated.

EDIT: With the "traditional" setting, the response from @JennaMa solved my problem. You can handle jQuery like the previous version. Here are some additional links that talk about changes, and blog posts.

Either a general statement

  jQuery.ajaxSettings.traditional = true;  

or as an additional option in the AJAX call

  $ Data Type: "Text", Data: Datatused, Success: Function (Request) {$ ('# result'). Html (Requested);} / Ajax ({Traditional: True, Type: "Post", "Post", URL: myURL, / Last success}}; // Ajax method  

to use PHP syntax to send an array of jQuery 1.4 Was updated for You can change it to an old style using:

  jQuery.ajaxSetting.traditional = true;  

See for details.


Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -