开发者

JQuery issue by IE

I get an error by following code:

jQuery.post('/user/result/generate',{
            'id': getHidden()
        }, function(html) {
            $('#result').html(html);
        });

error:

TypeError object doesn't support this property or method

this code works fine in FireFox, but not in IE.

How can I fix this?

p.s

the function getHidden() wil return a selected item id, it works very fine. I can see that this work!

I put alert() in this function... like this:

jQuery.post('/user/result/generate',{
        'id': getHidden()
    }, function(html) {
        alert(html);
        $('#result').html(html);
    });

function getHidden(){
alert($("#selectId").val());
return $("#selectId").val();
开发者_C百科

}

and I get the selectId well! but not html, so this function stops by function(html), thus by the response! I put try catch in this function, get error: TypeError object doesn't support this property or method

but this function works fine after refresh the page by press F5.... so I do not understand why this function works not directly but after refresh...


solved! I put the script bottom of html file, it works now both FF and IE.


What is "result" element ? It probably doesn't support .html() property, try .text() or .val()


Try putting getHidden in a var first.

var getId = getHidden();
jQuery.post('/user/result/generate',{
            'id': getId
        }, function(html) {
            $('#result').html(html);
        });
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜