I have a JQuery function that does an AJAX Post on a web service method. This function works well in FireFox, Chrome, Safari and IE 9 and lower. For some strange reason, IE10 does not pass the parameters needed to execute the web method and throws the following exception:
===========================================================================
ExceptionType=System.InvalidOperationException
Message=Invalid web service call, missing value for parameter: 'parameterX'.
StackTrace= at System.Web.Script.Services.WebServiceMethodData.CallMethod(Object target, IDictionary2 parameters)
at System.Web.Script.Services.WebServiceMethodData.CallMethodFromRawParams(Object target, IDictionary
2 parameters)
at System.Web.Script.Services.RestHandler.InvokeMethod(HttpContext context, WebServiceMethodData methodData, IDictionary`2 rawParams)
at System.Web.Script.Services.RestHandler.ExecuteWebServiceCall(HttpContext context, WebServiceMethodData methodData)
===========================================================================
I've tried to use all sorts of combinations of passing the data in the AJAX request including the JSON.stringify() method. None worked and this seems like a bug in IE10.
Here is the JQuery function:
var valueX = $inputBox.val().replace("'", "!");
var valueY = 1;
myNameSpace.activeAjaxRequest = $.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: webServiceMethodUrl,
data: JSON.stringify({ parameterX: valueX, parameterY: valueY }),
dataType: "json",
success: function (result) {
// some code here
}
,
error: function (sender, textStatus, errorThrown) {
// some code here
}
});
Any fix or workaround is highly appreciated!