【问题标题】:passing form variables through jquery .post通过 jquery .post 传递表单变量
【发布时间】:2010-11-25 09:02:28
【问题描述】:

这就是帖子的样子,我在“区域”div 中“打印”返回数据,因为该数据是一个隐藏的表单变量 input type='hidden' id='pc1' value=' wh5',是否有可能获得 id 'pc1' 的值?,我现在得到 'undefined'。你使用live还是bind?我看过这些,但它们似乎是针对点击事件的。

$("#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

      });


});

【问题讨论】:

    标签: jquery post


    【解决方案1】:

    你可以这样做:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-06-23
      • 1970-01-01
      • 2014-08-02
      • 2011-11-03
      • 1970-01-01
      • 2011-07-23
      • 2015-11-05
      • 1970-01-01
      相关资源
      最近更新 更多