admin管理员组

文章数量:1317898

I have a form loading inside my page and there is a button out side this form its function is to submit this form.

$('#MyForm').submit();

I want a way to write a submit plete function, means to know that the form successfully/pletely submitted.

I tried the jquery form plugin, but didn't work, i think because the submit e from a button outside the form.

anyone knows any different ways?

I have a form loading inside my page and there is a button out side this form its function is to submit this form.

$('#MyForm').submit();

I want a way to write a submit plete function, means to know that the form successfully/pletely submitted.

I tried the jquery form plugin, but didn't work, i think because the submit e from a button outside the form.

anyone knows any different ways?

Share Improve this question asked Jun 30, 2009 at 17:00 Amr ElgarhyAmr Elgarhy 69.1k70 gold badges192 silver badges310 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 6

Actually, you can use the jquery form plugin, just use the ajaxSubmit() method.

Documentation for the jQuery form plugin.

// setup the form, and handle the success
$('#myFormId').ajaxForm({
  success: function() {
     // do what you are looking to do on 
     // success HERE
  }
});

// setup submission on some random button
$('#someButton').click(function() { 
    // submit the form from a button
    $('#myFormId').ajaxSubmit(); 
});

本文标签: jqueryHow to write quoton form submit completequot using javascriptStack Overflow