Can I post JSON without using AJAX?
- Create an HTML form with unique "id" attribute. You can hide it using CSS "display:none". Also fill the action and method attributes.
- Add a
text
orhidden
input field to the form. make sure you give it a meaningful "name" attribute. That's the name that the server would get the data within. - Using JQuery (or plain old javascript) copy the variable "dat" into the input field
- Submit the form using script
There is a working draft to support the so called HTML-JSON-FORMS, see: http://www.w3.org/TR/2014/WD-html-json-forms-20140529/
So far use ajax or send the json into an input text field.
<form action="xxx.aspx" method="POST">
<input type='hidden' id='dat' />
<!-- Other elements -->
</form>
<script type='text/javascript'>
$('#dat').val(JSON.stringify(frm.serializeArray()));
</script>