简体   繁体   中英

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.

检查错误控制台中的错误-我的猜测是UpdateObjectSettings的第二行抛出错误。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM