對於頁面中複雜數據的提交:ajax
$.ajax({
type:"post",
url:url,
dataType: "json",
contentType: "application/json",
async:true,
data:JSON.stringify(param),
success:function(result){
if(result.code == "0"){
var rows = result.data;
if(typeof successcallback == 'function'){successcallback(rows);}else{alert(result.msg);}
}else{
alert(result.msg);
}
},
error:function(jqXHR, textStatus, errorThrown){
//alert("提交失敗,請重試!");
}
});
json
須要經過JSON.stringify(param)把頁面中獲取的參數變成json字符串,,此時須要加上contentType: "application/json",app