submitting forms in jquery tabs
Hi All,
I have been searching for days and cannot seem to come up with an answer.
I using jquery ui tabs
and I have a form in the tabs.
All my validation is done in my script which also contains my form i.e phpscript.php
jquery is calling my script, the form displays but when I try and submit data the form just refreshes.
this is the code in my head section.
Copy code
- <script>
- $(document).ready(function(){
- // set the tabs
- $("#tabs").tabs();
- // Capture the form's submit event
- $('.legal').live('submit', function() {
- $.ajax({ // create an AJAX call...
- data: $(this).serialize(), // get the form data
- type: $(this).attr('method'), // GET or POST
- url: $(this).attr('action'), // the file to call
- success: function(response) { // on success..
- $('.ui-tabs-panel:visible').html(response); // update the DIV
- }
- });
- return false; // cancel original event to prevent form submitting
- })
- });
- </script>
Copy code
- Please help