Sumbit Twice a form
|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
Sumbit Twice a formHow can i submit a form twice, let say I want to save the form data on my database and with the send the same form data to a different script in an external host. |
|
|
Re: Sumbit Twice a formI'd script the database host to send the data on to the second site, myself...
On Fri, Jul 4, 2008 at 6:18 PM, xomero <xomero@...> wrote:
-- David Morton mortonda@... - bulk address mortonda@... - direct to my server |
|
|
Re: Sumbit Twice a formThere's actually no way of submitting a form twice in two action urls in normal browser's capability. What you can do is that serialize all your variables into string using serialize() and use AJAX to submit into two locations one after another. like this <form action="" id="pform" onsubmit="return submit_my_form();"> <input type="text" name="input1"> <input type="text" name="input2"> </form> <script language="javascript"> function submit_my_form(){ $.ajax({ url : "url1.php", type : "post", data : $("#pform").serialize(), success : function(e){ // so form is submitted successfully !! } }); $.ajax({ url : "url2.php", type : "post", data : $("#pform").serialize(), success : function(e){ // so form is submitted successfully !! } }); return false; } </script> Hope this helps!! On Jul 5, 5:18 am, xomero <xom...@...> wrote: > How can i submit a form twice, let say I want to save the form data on > my database and with the send the same form data to a different script > in an external host. |
|
|
Re: Sumbit Twice a formOn Mon, Jul 7, 2008 at 9:02 AM, Mahbub <pappu687@...> wrote: > > There's actually no way of submitting a form twice in two action urls > in normal browser's capability. What you can do is that serialize all > your variables into string using serialize() and use AJAX to submit > into two locations one after another. like this > > <form action="" id="pform" onsubmit="return submit_my_form();"> > <input type="text" name="input1"> > <input type="text" name="input2"> > </form> > <script language="javascript"> > > function submit_my_form(){ > $.ajax({ > url : "url1.php", > type : "post", > data : $("#pform").serialize(), > success : function(e){ > // so form is submitted successfully !! > } > }); > > $.ajax({ > url : "url2.php", > type : "post", > data : $("#pform").serialize(), > success : function(e){ > // so form is submitted successfully !! > } > }); > return false; > } > > </script> > > Hope this helps!! > > On Jul 5, 5:18 am, xomero <xom...@...> wrote: >> How can i submit a form twice, let say I want to save the form data on >> my database and with the send the same form data to a different script >> in an external host. > i would handle that on the serverside of life, not the clientside. basically, your serverside script processes the form, saves it in a database, then if all correct, call the external form, via GET (that is, as query variables). -- Alexandre Plennevaux LAb[au] http://www.lab-au.com |
| Free Forum Powered by Nabble | Forum Help |