jQuery.Form wont submit

Posted by kim on Stack Overflow See other posts from Stack Overflow or by kim
Published on 2010-06-07T10:33:06Z Indexed on 2010/06/07 10:42 UTC
Read the original article Hit count: 195

Filed under:
|

Im´trying to submit a form without refreshing the page, but I´m having a problem. When I click submit the page refreshes and anothing gets posted. Here is the code, what am I doing wrong? (I´m a newbie)

jQuery 1.4.2 and the jQuery Form Plugin 2.43 is present.

tnx

$(document).ready(function() { 
    var options = { 
        target:        '#output2',
        url:       https://graph.facebook.com/<%=fbUid%>/feed,
        type:      post,

        clearForm: true        // clear all form fields after successful submit 
        //dataType:  null        // 'xml', 'script', or 'json' (expected server response type) 
        //resetForm: true        // reset the form after successful submit 

        // $.ajax options can be used here too, for example: 
        //timeout:   3000 
    }; 

    // bind to the form's submit event 
    $('#fbPostStatus').submit(function() { 
        // inside event callbacks 'this' is the DOM element so we first 
        // wrap it in a jQuery object and then invoke ajaxSubmit 
        $(this).ajaxSubmit(options); 

        // !!! Important !!! 
        // always return false to prevent standard browser submit and page navigation 
        return false; 
    }); 
}); 

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery