52,792
社区成员




<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 + "'";
}
}
<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: {'usernamedesc':'vusernamedesc','customerid':'vcustomerid'},
success: function(strvalue) {
if (strvalue == "true") {
alert("OK");
}
else {
view(data.msg);
}
},
error: function() {
alert("异常");
}
});
});
});
</script>
$.ajax({
type: "POST",
url: "Ajax.ashx",
data: { usernamedesc: $("#<%=txtusernamedesc.ClientID%>").val(),
customerid:$("#<%=txtcustomerid.ClientID%>").val()},
success: function (strvalue) {
if (strvalue == "true") {
alert("OK");
}
else {
view(data.msg);
}
},
error: function () {
alert("异常");
}
});
改成这样