开发者

.serialize() not returning values from dynamically generated form

开发者 https://www.devze.com 2023-01-18 21:36 出处:网络
I\'m missing something here. I have a form dynamically loading a form using jquery where .click() pulls in a $.post query that outputs the form with some specific data to .html().

I'm missing something here.

I have a form dynamically loading a form using jquery where .click() pulls in a $.post query that outputs the form with some specific data to .html().

I'm now trying to serialize the data from this form and it's not giving me anything. What am I doing wrong?

Code inserting form:

$(".edit").click(function(){
    var mid = $(this).attr("uid");
    $.post("inc/menu_mod.php", { page: "edit",menu_id: mid, sender: 'sent'}, function(data){
    $('#menu_mod').html(data);
    });             

    });
开发者_运维问答

My attempt to serialize:

    $(".update_menu").live('click', function(){
        alert("this fires, so I know it's working");
        var form = $('#menu_form form').serialize();
        alert(form);

    });

Thanks in advance!


I suspect your selector should be var form = $('#menu_form').serialize(); because menu_form is the id of the form.

0

精彩评论

暂无评论...
验证码 换一张
取 消