jquery使用ajax怎么提交form
$("button").click(function(){$.post("你的服务器文件",{//表单里的内容name:"DonaldDuck",city:"Duckburg"},function(data,status){alert("数据:"+data+"\n状态:"+status);});});
如何用ajax提交多组同样的数据(数组)到后台
下载个jquery.js
用.ajax函数,参数类型为json,后台用json_decode解码就成了数组了
$("#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);
}
});
});