Click here to Skip to main content
15,499,289 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
This is my Jquery Method
XML
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
Posted
Updated 12-Jun-13 20:26pm
v3

The data should be
JavaScript
var params = {"domainname":'" + domain + "'};
instead of
JavaScript
var params = "{domainname:'" + domain + "'}";


Hope this helps
 
Share this answer
 
v2
Comments
RahulRana723 13-Jun-13 1:29am    
sir,[domain] is variable.which is dynamic not static..i try ur solutions but not working
Jameel VM 13-Jun-13 1:33am    
Oops..I have updated my answer.Please try that
RahulRana723 13-Jun-13 1:37am    
sorry sir,not working
Jameel VM 13-Jun-13 1:40am    
is it working in other browsers?
Jameel VM 13-Jun-13 1:43am    
can you remove the quotes like '" + domain + "' to {"domainname": domain};
Hello,

Try to alert the value of domain .. may be there can be issue in getting domain value

var domain = $(domainId).parent().find("input[name$=whoisdomain]").val();
alert(domain);

Hope this helps...
 
Share this answer
 
Comments
RahulRana723 13-Jun-13 3:02am    
already try this..this working well

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900