ajax loads content how to submit form

ajax loads content how to submit form

Hi 

I have made so that my content is loaded with ajax like this and placed in a div 

  1. <ul id="navlist">
  2. <li><a href="home.php" class="home">Home</a></li>
  3. <li><a href="gallery.php" class="gallery">Gallery</a></li>
  4. <li><a href="upload.php" class="upload">Upload</a></li>
  5. </ul>

  6. <script>
  7. $(function () {

  8.     // attaching click handler to links
  9.     $("a.upload").click(function (e) {
  10.         // cancel the default behaviour
  11.         e.preventDefault();

  12.         // get the address of the link
  13.         var href = $(this).attr('href');

  14.         // getting the desired element for working with it later
  15.         var $wrap = $('#container');

  16.         $wrap
  17.             // removing old data
  18.             .html('')

  19.             // slide it up
  20.             .slideUp()

  21.             // load the remote page
  22.             .load(href + ' #laddaupp', function () {
  23.                 // now slide it down
  24.                 $wrap.slideDown();
  25.             });
  26.     });

  27. });
  28. </script>
But on one page I have a submit form that uploads to a database and saves in the folder on the server but when I click on submit it goes to the original upload.php how can i make it stay on the same page/div?