I'm using Prototype 1.6.1 to create a POST to a page. The POST data is a complex JSON object. Can someone tell me how on the receiving page I can access the raw body of the POSTed data?
Sending page:
myObject = {"key":"val",
"has many":{"key1":"val1",
"key2":"val2"}
}
new Ajax.Request('Worker.asp',
{
method:"post",
postBody:Object.toJSON(myObject),
onSuccess: function(transport){
var response = transport.responseText || "no response text";
alert("Echo'ing back what you sent: \n\n" + response);
},
onFailure: function(){ alert('Something went wrong...') }
});
So that's the sending page. Makes an object, and a request. I've used FireBug to ensure that the POST data being sent looks like what I want it to look like.
Now on the target page, I'm having trouble accessing the POSTed data. I tried the following, and it did not work.
Receiving page:
<% Response.BinaryWrite(Request.BinaryRead(Request.TotalBytes)) %>
But I get server error 500. So basically, I'd like to know how I can use what I have POSTed. Any help is greatly appreciated!