开发者

jquery .html() problem with IE

开发者 https://www.devze.com 2023-03-26 04:05 出处:网络
<form name = \"id_form\"> <input type = \"hidden\" name= \"id_data\" value = \"\'.$id.\'\">
<form name = "id_form">
     <input type = "hidden" name= "id_data" value = "'.$id.'">
     <input type = "button" value = "Request Price" id = "sess_s" >
</form&开发者_如何学Pythongt;

$('#sess_s').click(function() {
    $.post('data.php',{id_value: id_form.id_data.value  },
       function(output) {
       $('#sess_feed_top').html(output).show();
    });

 });

As soon I click the button #sess_s, the data suppose to show disappears in IE. It works fine with other browsers. I think the problem with .html(output). any solution? thanks


I'm not sure you can rely on global variables for form fields.

var dataHolder = $('form[name=id_form] input[name=id_data]');

$('#sess_s').click(function() {
    $.post(
        'data.php',
         {id_value: dataHolder.val()},
         function(output) {
             $('#sess_feed_top').html(output).show();
         }
    );
});
0

精彩评论

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