this is fixed now: i changed this: $("form:last").bind("submit", submit_optin); to: $("form:last").find(":submit").bind("submit", submit_optin);
On Jul 14, 9:49 pm, Sandy <[EMAIL PROTECTED]> wrote: > hi, > > i wanna try to save the data from a form to a database before > submitting it to it's rightful "action" url. this is an opt-in form i > wanna work on. > > i did this: $("form:last").bind("submit", submit_optin); > /* i altered the submit event of the opt-in form so it uses the > submit_optin function i created */ > > here's the submit_optin function: > var submit_optin = function(){ > var pbform = {name:"opt-in name", email: "opt-in email"}; // this > is jus a sample data to be saved. > $.post("http://www.myurl.com/save_data", pbform); > return true; // return true so it submits the form to it's rightful > "action" url (which is a url from a different domain/server) > > }; > > now for the MAIN PROBLEM... if i set submit_optin to return false it > saves the data but if i set it to return true it just submits the form > without saving the data... now is there a way to stop and wait before > it saves the data before it submits the form? or is there any way i > can achieve my goal? > > please help, thanks :-)