PDA

View Full Version : Submitting a form via normal POST and via AJAX



paha
31 Jul 2007, 11:16 AM
Hi Everybody!

I have a regular html form:



<form id="form_id" action="submit.php" method="POST">
<input type="text" name="field_1" />
<input type="button" id="ajax_post_button" value="AJAX POST" />
<input type="submit" value="Regular POST"/>
</form>


I create a BasicForm:



var form = new Ext.form.BasicForm(
'form_id',
{
url: 'submit2.php'
}
);


Is it possible to make the form submitted to submit2.php via AJAX by clicking the "AJAX POST" button and submitted via a regulart post to submit.php by clicking the "Regular POST" button?

I've digged into the Ext documentation and forums but not found anything. :(

Thank you!

31 Jul 2007, 3:11 PM
Why not just create a form dynamically then? Else you can just get the data values from the form and send them through XHR directly.