SkipFire
Visitor

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
Community is Temporarily in Read-Only Mode!

We’re upgrading Roku Community to bring you a faster, more mobile-friendly experience. You may notice limited functionality or read-only access during this time. You will not be able to log in or post new comments or kudos during this time. Read more here.

Planned Downtime:
Community will be unavailable for up to 24–48 hours during the upgrade window during the week of May 12 and you may notice reduced functionality. In the meantime, for additional assistance, visit our Support Site.

Thanks for your patience — we’re excited to share what’s next!