$.ajax({ type: "POST", url: "test.php", data: "name=garfield&age=18", success: function(data){ $("#myDiv").html('<h2>'+data+'</h2>'); } });
异步的表单提交
$.ajax({
cache:
true
,
type:
"POST"
,
url:ajaxCallUrl,
data:$(
'#yourformid'
).serialize(),
// 你的formid//自动收集你的表单数据
async:
false
,
error:
function
(request) {
alert(
"Connection error"
);
},
success:
function
(data) {
$(
"#commonLayout_appcreshi"
).parent().html(data);
}
});