Alexis Alexis - 23 days ago 17
jQuery Question

TypeError: (intermediate value).apply is not a function

I am trying to submit a form with the button that is not inside the form...

<form id="updateForm">
<input type="text" name="a" />
<input type="text" name="b" />
</form>

<input type="button" class="done"/>


I have this jquery function that I tried

$(".done").click('#updateForm','submit',function(e)
{

$.ajax(
{

});
});


But... I get the error. Is there any alternatives?

Answer

If you just want to submit the form, that's what you should do

$(".done").click(function() {

    var form = $('#updateForm');

    $.ajax({
        url  : form.prop('action'),
        type : form.prop('method'),
        data : form.serialize()
    }).done(function(result) {

    });
});