tags: Pit experience
front end:
ids = [1,2,3,4]
data = {
"ids":ids
}
data = JSON.stringify(data)
$.ajax({
url: "{{ url_for('Index.Buy') }}",
data: data,
success: function (data) {
console.log("Successful purchase");
}
});
Backstage:
Never found the right direction. . . .
ids = [1,2,3,4]
$.ajax({
url: "{{ url_for('Index.Buy') }}",
data: {
"ids":ids
},
traditional:true, #Pass array must
success: function (data) {
console.log("Successful purchase");
}
});
Backstage:
ids = request.form.getlist("ids")
OK. . .
Front End Page JS Write: Import Ali's JAR package: Background Java server Receive: Entity class properties correspondence parameter name: ...
Use Ajax to pass the JSON array to MVC background front end Front -end code: Background code:...
surroundings Reception to pass parameters to the background Reception using ajax Background use springMVC Transmission parameters are a plurality of objects N JSON object and JSON string In SpringMVC ...
Passing data in ajax can be used Background reception can be used: Note: The key is the $.ajax({traditional: true,}) setting, not the next String[] checkedIds can't receive the value. &n...
Ajax pass array: Ajax pass object: ...
Examples ...
Backstage $.ajax({ url: “/bill/distribute”, type: “post”, data: {“ids”: 1,2,3,4,5,}, dataType: “json”, success: function (data) { Global.success(success...
If you want to use ajax to pass the array to the background,traditional must be set to true。...
similar parameters...
traditional: Whether to use traditional shallow serialization....