To understand and solve the problem it was really good to read following articles:
- Using jQuery to Consume ASP.NET JSON Web Service
- A breaking change between versions of ASP.NET AJAX
So now it’s time for a solution…
The WebMethod that should be called:
As you can see, I’ve instantiated the ‘dataToPass’ object that contains all the data that will be passed to WebMethod. Then I’ve created the JSON string by serializing the ‘dataToPass’ object. It was done by using the json2.js plugin. And finally, such text containing JSON content could be passed as a parameter to the JQuery Ajax method.