开发者

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>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜