开发者

passing form variables through jquery .post

开发者 https://www.devze.com 2023-01-26 17:06 出处:网络
This is what the post looks like, I\'m \"printing\" the return data out in the \'area\' div, in that data is a hidden form variable input type=\'hidden\' id=\'pc1\' value=\'wh5\', is it possible to ge

This is what the post looks like, I'm "printing" the return data out in the 'area' div, in that data is a hidden form variable input type='hidden' id='pc1' value='wh5', is it possible to get the value of id 'pc1'?, I get 'undefined' at the moment. Do you use live or bind?开发者_如何学C I had a look at those but they appear to be for click events.

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

      });


});


You could do this:

function(data){

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


      });
0

精彩评论

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