$.ajax({
url:"SomeURL",
data: {
fields : ["field1", "field2"],
},
success: function(data) {
}
});
Getting this in the server:
name = fields[] , VALUE = field1
name = fields[] , VALUE = field2
(note the brackets)
Is that a bug? (This starting to happen after I upgraded to 1.5)
Thanx
If an AJAX request fails, you can react to the failure inside the callback function added via the fail() function of the object returned by the $. ajax() function. Here is a jQuery AJAX error handling example: var jqxhr = $.
The ajax() method is used to perform an AJAX (asynchronous HTTP) request. All jQuery AJAX methods use the ajax() method. This method is mostly used for requests where the other methods cannot be used.
The param() method creates a serialized representation of an array or an object. The serialized values can be used in the URL query string when making an AJAX request.
It is not a bug, the serialization changed (but already in jQuery 1.4). Have a look at the traditional
option:
traditional Boolean
Set this totrue
if you wish to use the traditional style of param serialization.
And from jQuery.param()
(also have a look at the example):
As of jQuery 1.4, the
$.param()
method serializes deep objects recursively to accommodate modern scripting languages and frameworks such as PHP and Ruby on Rails. You can disable this functionality globally by settingjQuery.ajaxSettings.traditional = true;
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With