hyperlink - jquery: how use sumbit() functions in click() event? -


how use submit , ajax functions on click event? need send input hidden server using link no found in click event.... solution? please help!

p.d. sorry english xd

     $('#delete_link').click(function() {                              $('#myform').submit(function() {                                  if ($('#codigo').val().length < 1) {$('#notice').html('error'); return false; }                                  $.ajax({                                          type: "post",                                          url: 'mantenimiento.php?action=eliminar',                                          data: $(this).serialize(),                                          success: function(data) {                                              switch(data){                                                 case 'success':                                                     window.location.reload();                                                     break;                                                 default:                                                     $('#notice').html('<p class="error">'+data+'<\/p>');                                                     break;                                             }                                       }                                    });                                 return false;                             });              }); 

this bit:

$('#delete_link').click(function() {     $('#myform').submit(function() { 

is binding function submit event on #myform (when #delete_link clicked), doesn't trigger event.

i think want like:

$('#myform').submit(function() {   // stuff when submit }); $('#delete_link').click(function() {     $('#myform').trigger('submit'); }); 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -