I\'ve been having problems with this code I had spent the last 3 hours digging around and trying to find an answer. As I wasn\'t successful, I will just post the code and as
Try passing the data as a string, not an object, ie:
$.ajax( { ... data : '{ a: 2, b: 3 }', ... } );
The reasoning for this is that if you specify an object as data then jQuery serializes the data using query string format, whereas the server is expecting JSON format directly.
This happens despite telling jQuery to use JSON as the data type - it seems to only relate to the result, not the request payload sent to the server.
Everything else you have there looks correct to me.