如何用ajax提交多組同樣的數(shù)據(jù)數(shù)組到后臺?
下載個jquery.js
用.ajax函數(shù),參數(shù)類型為json,后臺用json_decode解碼就成了數(shù)組了
$("#btn2").click(function() {
$.ajax({
type: "POST",
contentType: "application/json",
url: "server.php",
data: "{name: "aaa", age: "20"}, {name: "bbb", age: "20"}, {name: "ccc", age: "20"}
",
dataType: 'json',
success: function(result) {
alert(result.d);
}
});
});