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…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?


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

<script>
$(function () {

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

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

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

        $wrap
            // removing old data
            .html('')

            // slide it up
            .slideUp()

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

});
</script>

You can change the submit button into a button type if you are only using ajax to process the form data.


<input type="button" id="mybutton" value="click me" />