How can I create a callback function for jQuery's trigger() function? -


i use trigger() force form submission , need execute function after form submission complete. assume way callback function, seems trigger doesn't allow callback functions. how can achieve same result? want equivalent following:

$('#fileuploadbutton').trigger('click',function(){     // callback function code goes here. }); 

you can push form submit ajax-request. if request succeed can anything. alternative use postmessage communicate between 2 frames.

example ajax-request:

$(":submit").click(function(event) {     event.preventdefault();     $.ajax({         type : "post",         url  : $(this).parents("form:first").attr("action"),         data : $(this).parents("form:first").serialize(),      })      .done(function(data) {          // submit done:      }) }); 

Comments