这是我的Jquery方法
var domain = $(domainId).parent()。find(input [name $ = whoisdomain])VAL(); var params ={domainname:'+ domain +'}; $ .ajax({类型:'POST', url:'.. / SearchResult.aspx / GetResult', contentType:'application / json ; charset = utf-8', data:params, dataType:'json', processData:true,成功:AjaxSucceeded,错误:AjaxFailed }); 服务器端WebMethod Is: [WebMethod] [ScriptMethod(ResponseFormat = ResponseFormat.Json)] public静态列表< 字符串 > GetResult (字符串域名) { //代码在这里}错误是: {消息:无效的Web服务调用,缺少参数值:\ u0027domainname \ u0027。,StackTrace:at System.Web.Script.Services System.Web上的System.Web.Script.Services.WebServiceMethodData.CallMethodFromRawParams(Object target,IDictionary`2 parameters)\\\\ n中的.WebServiceMethodData.CallMethod(Object target,IDictionary`2参数)\\\\ n .Script.Services.RestHandler.InvokeMethod(HttpContext context,WebServiceMethodData methodData,IDictionary`2 rawPa rams)\\\ at System.Web.Script.Services.RestHandler.ExecuteWebServiceCall(HttpContext context,WebServiceMethodData methodData),ExceptionType:System.InvalidOperationException} Plz告诉我错误在哪里..这个代码在除了Internet Explorer之外的所有浏览器中都能正常工作10
解决方案(domainId).parent()。find(input [name
= whoisdomain] ).VAL(); var params ={domainname:'+ domain +'};
.ajax({ type:'POST', url:'../SearchResult.aspx/GetResult', contentType:'application / json; charset = utf-8', data:params, dataType:'json', processData:true,成功:AjaxSucceeded,错误:AjaxFailed }); 服务器端WebMethod Is: [WebMethod] [ScriptMethod(ResponseFormat = ResponseFormat.Json)] public静态列表< 字符串 > GetResult (字符串域名) { //代码在这里}
错误是: {消息:无效的Web服务调用,缺少参数值:\ u0027domainname \ u0027。,StackTrace:at System.Web.Script.Services System.Web上的System.Web.Script.Services.WebServiceMethodData.CallMethodFromRawParams(Object target,IDictionary`2 parameters)\\\\ n中的.WebServiceMethodData.CallMethod(Object target,IDictionary`2参数)\\\\ n .Script.Services.RestHandler.InvokeMethod(HttpContext context,WebServiceMethodData methodData,IDictionary`2 rawPa rams)\\\ at System.Web.Script.Services.RestHandler.ExecuteWebServiceCall(HttpContext context,WebServiceMethodData methodData),ExceptionType:System.InvalidOperationException} Plz告诉我错误在哪里..这个代码在除了Internet Explorer之外的所有浏览器中都能正常工作10
This is my Jquery Method
var domain = $(domainId).parent().find("input[name$=whoisdomain]").val(); var params = "{domainname:'" + domain + "'}"; $.ajax({ type: 'POST', url: '../SearchResult.aspx/GetResult', contentType: 'application/json; charset=utf-8', data: params, dataType: 'json', processData:true, success: AjaxSucceeded, error: AjaxFailed }); Server side WebMethod Is: [WebMethod] [ScriptMethod(ResponseFormat = ResponseFormat.Json)] public static List<string> GetResult(string domainname) { //code is here }ERROR IS: {"Message":"Invalid web service call, missing value for parameter: \u0027domainname\u0027.","StackTrace":" at System.Web.Script.Services.WebServiceMethodData.CallMethod(Object target, IDictionary`2 parameters)\r\n at System.Web.Script.Services.WebServiceMethodData.CallMethodFromRawParams(Object target, IDictionary`2 parameters)\r\n at System.Web.Script.Services.RestHandler.InvokeMethod(HttpContext context, WebServiceMethodData methodData, IDictionary`2 rawParams)\r\n at System.Web.Script.Services.RestHandler.ExecuteWebServiceCall(HttpContext context, WebServiceMethodData methodData)","ExceptionType":"System.InvalidOperationException"} Plz tell me where is the error..this code work fine in all browers except Internet Explorer 10
解决方案 (domainId).parent().find("input[name=whoisdomain]").val(); var params = "{domainname:'" + domain + "'}";.ajax({ type: 'POST', url: '../SearchResult.aspx/GetResult', contentType: 'application/json; charset=utf-8', data: params, dataType: 'json', processData:true, success: AjaxSucceeded, error: AjaxFailed }); Server side WebMethod Is: [WebMethod] [ScriptMethod(ResponseFormat = ResponseFormat.Json)] public static List<string> GetResult(string domainname) { //code is here }ERROR IS: {"Message":"Invalid web service call, missing value for parameter: \u0027domainname\u0027.","StackTrace":" at System.Web.Script.Services.WebServiceMethodData.CallMethod(Object target, IDictionary`2 parameters)\r\n at System.Web.Script.Services.WebServiceMethodData.CallMethodFromRawParams(Object target, IDictionary`2 parameters)\r\n at System.Web.Script.Services.RestHandler.InvokeMethod(HttpContext context, WebServiceMethodData methodData, IDictionary`2 rawParams)\r\n at System.Web.Script.Services.RestHandler.ExecuteWebServiceCall(HttpContext context, WebServiceMethodData methodData)","ExceptionType":"System.InvalidOperationException"} Plz tell me where is the error..this code work fine in all browers except Internet Explorer 10
更多推荐
Jquery Ajax方法调用错误
发布评论