色彩下牛 2014年01月06日
Jquery 不执行后台方法! 求高手指教
 <script type="text/javascript">
$(document).ready(function() {
$("#<%=btnSearch.ClientID%>").click(function() {
var vusernamedesc = $("#<%=txtusernamedesc.ClientID%>").val();
var vcustomerid = $("#<%=txtcustomerid.ClientID%>").val();
var strjson = jquery.param({'usernamedesc':'vusernamedesc','customerid':'vcustomerid'});
$.ajax({
type: "POST",
url: "Ajax.ashx",
data: strjson,
success: function(strvalue) {
if (strvalue == "true") {
alert("OK");
}
else {
view(data.msg);
}
},
error: function() {
alert("异常");
}
});
});
});
</script>


————————————————————————————————————————
后台代码

using System;
using System.Web;

public class Ajax : IHttpHandler {

public void ProcessRequest (HttpContext context)
{
context.Response.ContentType = "application/json";
string struserDesc = context.Request.QueryString["usernamedesc"];
string strcustomerid = context.Request.QueryString["customerid"];
if (struserDesc == "" || strcustomerid == "")
{
string strQuery = "Select * from qxtdb.dbo.customer_login where username = '" + struserDesc + "' and customerid = '" + strcustomerid + "'";
}
}


...全文
605 点赞 收藏 11
写回复
11 条回复

还没有回复,快来抢沙发~

发动态
发帖子
Ajax
创建于2007-09-28

3.2w+

社区成员

2.5w+

社区内容

Web 开发 Ajax
社区公告
暂无公告