Stijn Bernards
Stijn Bernards

Reputation: 1091

Jquery form submit return false not working

I'm including this form using ajax:

<form action="" method="post">
    <input type="number" name="user_id" placeholder="user id" id="user_id_input"/>
    <input type="submit" value="update">
</form>

My code:

$.get("application/views/beheer/html/"+widgetName+"div.html", function(response){
    $widgetDiv.html("<div class=\"widget_"+widgetName+"\" id=\""+widgetArray.length+"\">"+response+"</div>");
    var $form = $(".widget_"+widgetName).find("form");
    $form.submit(function( event ){
        UpdateObjectSettings($form);
        return false;
    });

});

function UpdateObjectSettings($form){
    //var id = $form.parent().attr("id");

    //widgetArray[(id - 1)].Update($form);
    return false;
}

If I enter an alert inside the $form.submit it still works. If I decomment the lines inside the UpdateObjectSettings the return false inside the submit won't work.

Thanks for any help.

Upvotes: 0

Views: 971

Answers (1)

evilunix
evilunix

Reputation: 960

Check the error console for errors - my guess is the second line in UpdateObjectSettings is throwing an error.

Upvotes: 1

Related Questions