проверено с предупреждением .. но вызов ajax не работает, и мой aspx.cs, когда я меняю .net framework с 3.5 на 4.0
моя функция ajax
function GetCustomers(pageIndex) {
$.ajax({
type: "POST",
url: "Webusers.aspx/GetCustomers",
data: '{searchTerm: "' + SearchTerm() + '", pageIndex: ' + pageIndex + '}',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: OnSuccess,
failure: function (response) {
alert(response.d);
},
error: function (response) {
alert(response.d);
}
});
}
и мой.cs метод
[WebMethod(EnableSession = true)]
public static string GetCustomers(string searchTerm, int pageIndex)
{
string query = "SearchWebUserData";
if (!string.IsNullOrEmpty(HttpContext.Current.Request.Form["gender"]))
{
string sSeraachType = HttpContext.Current.Request.Form["gender"];
}
SqlCommand cmd = new SqlCommand(query);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@SearchTerm", searchTerm);
cmd.Parameters.AddWithValue("@PageIndex", pageIndex);
cmd.Parameters.AddWithValue("@PageSize", PageSize);
cmd.Parameters.AddWithValue("@flag", "E");
cmd.Parameters.Add("@RecordCount", SqlDbType.Int, 4).Direction = ParameterDirection.Output;
return GetData(cmd, pageIndex).GetXml();
}