Jquery Ajax 调用后台方法

jQuery(function () {
jQuery("#fff").click(function (e) {
e.preventDefault();
var url = 'WebForm1.aspx' + "?rand=" + Math.random();
var str = "btnAjaxGet_click";
jQuery.post(url, { txtname: str }, function (data, static) {
if (data = "True") {

ShowUnknowMail();

}
});
});
});


function ShowUnknowMail()
{
if (!isWinExist("MailForUnknow"))
{
contentWin = new HWWeb("MailForUnknow");
contentWin.showWindow({ title: '', themeName: "alphacube", url: '../PlaceOrder/MailForUnknow.aspx', top: 200, left:220, 550 , height: 300});
}
else
{
alert("This window is open !");
}
}

if (!string.IsNullOrEmpty(Request["txtname"]))
{
string name = Request["txtname"];
if (name == "btnAjaxGet_click")
{
Response.Write("True"); //这是输出的返回值 data=true
//ajaxValue();
int i = BllLibrary.ajax(); //操作数据库
}
else
{
Response.Write("False");
}

}

原文地址:https://www.cnblogs.com/yzenet/p/2662429.html