2010-11-25 143 views
0

这是帖子的样子,我在“区域”div中“打印”返回数据,这个数据是一个隐藏的表单变量input type ='hidden'id ='pc1'value ='wh5',是否有可能获得id'pc1'的值?,我现在得到'undefined'。你使用活的还是绑定的?我看了看那些,但它们似乎是点击事件。通过jquery传递表单变量.post

$("#chk").click(function(){$.post("includes/mainform_new.php",{ 

postcode:$("#postc").val() 

}, 

    function(data){ 

     $("#area").html(data); <--- the input element pc1 is in the returned data 

     alert($("#pc1").val()); <--- returns undefined 

     }); 


}); 

回答

1

你可以这样做:

function(data){ 

     var response = $("#area").html(data); <--- the input element pc1 is in the returned data 
     alert((response.find("#pc1").val()) 


     }); 
+0

哦好的,非常感谢 – jimsmith 2010-11-25 09:20:54