Everyone should have found out that when we send an AJAX request with an array in the data, it can't be sent back to the background like normal JSON data.
For example, there is a data that needs to be sent back to the background:
{
"orderId": "
Resourcejson": [
{
"carcapacity": 223,
"Carnumber": "123",
"Driverinfo": "123",
"Failreason": "3123123", "
ID": ","
Ispass ": 0,
" lineId ": 784,
" Load_plan ":" 123 ",
"Onpackageday": 123,
"price": 123,
"storeoutcapacity": 123,
"store_out_capacity": 123
},
{
"Failreason": "31231231", "
ID": 2,
"Ispass": 0,
"lineId": 787,
"Load_plan": "123",
"store_out_capacity": 123,
"Tallyman": "DDD"
},
{
"Failreason": "123123",
"id": 1,
"Ispass": 0,
"lineId": 785,
"Load_plan": "123",
"store_out_capacity": 123, "Tallyman":
" FFF "
}
]
}
Where the Resourcejson field is an array, if you pass this JSON data directly to the background
The data from backstage is this way:
The browser will automatically make the array solution to form a variable, backstage to get this data directly silly force.
So, the best way to do this is to put the array in a programming string, simply by saving the array with a variable, and then JSON.stringify (the array), putting the resulting string in the JSON data so that the browser doesn't automatically deconstruct the array, and the backend gets a real array.
Summarize
The above is the entire content of this article, I hope the content of this article for everyone's study or work can bring certain help, if you have questions you can message exchange.