Ajax中get提交和post提交的区别

时间:2021-05-22 18:46:08
$.post("HandlerLiuYan.ashx", { leixing: leixing, danwei: danwei, liuyan: liuyan, name: name, phone: phone, email: email },
function (data) {
//alert(data);
if (data == "true") {
alert("留言成功,我们会尽快给您回复!");
$("[name='quxiao']").click();
}
});

后台接收:

if (context.Request.Form["leixing"] != null)
{
leixing = context.Request.Form["leixing"].ToString();
}

get提交:

$.get("HandlerLiuYan.ashx", { leixing: leixing, danwei: danwei, liuyan: liuyan, name: name, phone: phone, email: email },
function (data) {
//alert(data);
if (data == "true") {
alert("留言成功,我们会尽快给您回复!");
$("[name='quxiao']").click();
}
});

后台提交:

if (context.Request.QueryString["leixing"] != null)
{
leixing = context.Request.QueryString["leixing"].ToString();
}