<form id="submitform" action="">
<button id="demo" onclick="saveObject()">Click me to save.</button>
<input type="hidden" id="jsonstring" name="jsonstring"/>
</form>
<script>
function saveObject(){
var JsonString = JSON.stringify(jsonObject);
document.getElementById('jsonstring').value = JsonString;
document.getElementById('submitform').action = "saveAction";
document.getElementById('submitform').submit();
}
I would like to pass my JsonString as String to the struts2 action classes by clicking on a button, this string is created dynamically inside saveObject() function. Now my question is, for the short string, I can send with the form, but when the String is very long, errors comes... Failed to load resource: the server responded with a status of 400 (Bad Request)
Actually, I don't want my string shown in the url by the form submit as well. Does anyone have any solution in my case? Thank you very much in advanced!!!