Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
SkipFire
Level 7

Post with JSON

I've looked through docs and post and haven't found an answer yet, so how do I send JSON as part of a post request? The ParseJSON piece I need to use on the return shouldn't be a problem, but I have to submit JSON along with the post in order to get the JSON return. Below is a javascript version of what I need to do.

function GetData(requestType, requestValue) {
var Request = { RequestType: requestType, RequestValue: requestValue };
urlToHandler = 'JSONHandler.ashx';
jsonData = JSON.stringify(Request, null, 2);
$.ajax({
url: urlToHandler,
data: jsonData,
dataType: 'json',
type: 'POST',
contentType: 'application/json',
success: SuccessFunction,
error: function (data, status, jqXHR) {
alert('There was an error.');
}
});
}
0 Kudos