jQWidgets Forums
jQuery UI Widgets › Forums › Form › Getting HTTP Response after JqxForm Submission
Tagged: jqxForm submit
This topic contains 1 reply, has 2 voices, and was last updated by Martin 6 years, 4 months ago.
-
Author
-
How do I get the HTTP Response Code from the server’s Response Object after I submit the form’s values to the server?
Basics of code below:<head> ... <script type="text/javascript"> $(document).ready(function () { ... var theIFrame0 = $('#iframe_a').get(0); theIFrame0.addEventListener("load", function(){ // // the following line of code gets the response coming from the server after the form is submitted. // I would like to get the response code so I know if this is an error message or a success message // without having to parse the text (which seems quite cheesy). // var iFrame_a_text = theIFrame0.contentWindow.document.body.innerHTML; console.log(iFrame_a_text); }); ... // // more code here defining the form patterned after the examples in the jQWidgets documentation // $('#icdForm').jqxForm({ template: template, value: formValue, padding: { left: 10, top: 10, right: 10, bottom: 10 } }); $("#dialog").jqxWindow('open'); subButton = $('#icdForm').jqxForm('getComponentByName', 'submitButton'); subButton.on('click', function () { <strong>$('#icdForm').jqxForm('submit', "modifyicdcodejqx1", "iframe_a", 'GET');</strong> $("#dialog").jqxWindow('close'); }); }); </script> </head> <body class='default'> <div id="table" ></div> <div style="visibility: hidden;" id="dialog"> <div>Edit ICD Form</div> <div style="overflow: visible;"> <div id='icdForm' style="width: 400px; height: auto;"></div> </div> </div> <iframe name="iframe_a" id="iframe_a" style="visibility: hidden;"/> </body>
The form values get to the server correctly; the database is updated correctly; the server sends back a response — could be success or failure. Server sets the response:
1. error –> return(reo.status(HttpStatus.PRECONDITION_FAILED)…);
2. success –> return (reo.status(HttpStatus.CREATED)…);How do I get a handle on the response code when I didn’t ajax it over to the server myself?
Thanks,
TT MMHello TT MM,
JqxForm is not an html form. It is used for creating and aligning the elements.
What you can do is to wrap the elements inside a form tag and put a submit button for sending the form to your server
via ajax.Best Regards,
MartinjQWidgets Team
http://www.jqwidgets.com/ -
AuthorPosts
You must be logged in to reply to this topic.