submitting forms in jquery tabs

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

  1. <script>
  2. $(document).ready(function(){
  3. // set the tabs
  4. $("#tabs").tabs();
  5. // Capture the form's submit event
  6. $('.legal').live('submit', function() {
  7. $.ajax({ // create an AJAX call...
  8. data: $(this).serialize(), // get the form data
  9. type: $(this).attr('method'), // GET or POST
  10. url: $(this).attr('action'), // the file to call
  11. success: function(response) { // on success..
  12. $('.ui-tabs-panel:visible').html(response); // update the DIV
  13. }
  14. });
  15. return false; // cancel original event to prevent form submitting
  16. })
  17. });
  18. </script>
  19. Copy code
    1. Please help