encountered this problem also looked for a lot of network resources, the Internet is mostly said that the array has two ways: one is splicing string, the second is the request is the use of traditional mode traditional:true;
Citation ( 76165971 ) ( 53836906/ )
Most of the answers are in the second way, but this approach is not resolved for my request.
finally through 415 error found contentType:application/x-www-form-urlencoded not allowed;
Finally, find out the following information:
ContentType mainly sets the format you send to the server,dataType Sets the format you receive the server data.
# #而contentType default format is application/x-www-form-urlencoded;
This format is characterized by, Name/value Become a group, between each group with & join, and name value = connection. This pass can only be a simple key-value pair format pass, which is a simple json format; But in complex cases, a complex json format array nested objects, objects containing arrays or objects nested arrays, arrays containing objects, etc., application/ X-www-form-urlencoded There is no way to organize complex JSON into key-value pairs. {A: 1, B: 2, C: 3}
# #contentType : Application/json ; This type is text , we Ajax the complex JSON Data with json.stringify after serialization, it is then sent, on the server side and then with the Json.parse It's OK to restore, so you can handle complex objects.
{data: {a: [{x: 2}]}}
Ajax data request to pass an array object type value unsuccessful understanding!