How to read data posted to classic ASP with jQuery AJAX How to read data posted to classic ASP with jQuery AJAX ajax ajax

How to read data posted to classic ASP with jQuery AJAX


The way the data is posted using this method (as posted in the question) doesn't really create a form object on the server side. So the posted data is to be read using Request.BinaryRead and then converted to string using one of the methods given here. As you have already noted, if you send the data using query string form key1=value1&key2=value2 or a map of the form {key1: 'value1', key2: 'value2'}, the posted data is a valid form and ASP would convert it to a Request.Form that can be read much easily.


Okay, I've found something that works. The following line of code:

var jsonToSend = "\"text\": \"" + escape(text) + "\"";

needs to be changed to

var jsonToSend = { text: escape(text) };