[英].serialize() not returning values from dynamically generated form
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(). 我有一个使用jquery动态加载表单的表单,其中.click()引入$ .post查询,该查询将带有一些特定数据的表单输出到.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();
我怀疑您的选择器应该是
var form = $('#menu_form').serialize();
because menu_form
is the id
of the form. 因为
menu_form
是表单的id
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.