How to create a button in a jsp page, that submits all forms on that page to their resp. form action
I have a JSP web page where multiple forms are shown at a time. I want to create one button that submits all forms to their respective actions. Can this be do开发者_开发技巧ne? How to implement this? All the forms belong to different 3rd party sites.
Ajax post. For example, use jQuery and the jQuery Form plugin.
Then something like this to submit all forms with a button click
<input type="button" value="Submit all" id="submitAll">
<script type="text/javascript">
$(document).ready(function() {
$('#submitAll').click(function() {
$('form').ajaxSubmit({
success: function(responseText, statusText, xhr, $form) {
alert('form submitted, return status:' + statusText);
}
});
});
});
</script>
精彩评论