开发者

Has no method parseJSON with jquery

This is my code:

$(document).ready(function(){
        $('.filter_users').live('click', function() {
            var obj = jQuery.parseJSON('{"name":"John"}');
            alert( obj.name === "John" );
        });
});

In the moment I'm clicking the class filter_users (It'开发者_高级运维s a simple checkbox..) It shows me an error:

Uncaught TypeError: Object function (E,F){return new o.fn.init(E,F)} has no method 'parseJSON'

Why does it happen? The jQuery file is from here - http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js

Other jQuery elements work well.


The .parseJSON was added to jQuery only at version 1.4.1 so it means you probably use older version.

Good chance that you include both old version and new version, and since the old version is included later it "overrides" the new version.

Include only the new version and it will work.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜