JQuery submit not working in Chrome

后端 未结 3 411
情书的邮戳
情书的邮戳 2021-01-20 00:25

Following is the form

@using (Html.BeginForm(MVC.CollectionPlanConfirmation.ActionNames.Edit, MVC.CollectionPlanConfirmation.Name, FormMethod.Post, new { @id         


        
相关标签:
3条回答
  • Try this:

    HTML

    <input type="button" value="Save" class="aSubmit" />
    

    SCRIPT

    $(function () {
        $(document).on('click', '.aSubmit', function () {
            $('#collectionPlanForm').submit();
        });
    });
    

    DEMO FIDDLE

    0 讨论(0)
  • 2021-01-20 01:06

    The best way to perform a submit for jquery is in this way.

    $('#submitButton').click( function() {
        $.ajax({
            url: 'some-url',
            type: 'post',
            dataType: 'json',
            data: $('form#myForm').serialize(),
            success: function(data) {
                 console.log("success");
            }
        });
    });
    

    http://jsfiddle.net/BD3Rt/

    Always nice to keep html clean and separate your jquery/javascript code.

    0 讨论(0)
  • 2021-01-20 01:08

    put ID for form and use $("#yorID").submit() and you can see the example here example

    0 讨论(0)
提交回复
热议问题