简体   繁体   中英

no method domReady error in console even though domReady gets called

I'm new to Javascript so forgive me if I kill this question.

I've got a script to grab my latest twitter posts and place it on my blog:

http://www.joshkerr.com

It isn't working. The error I see in the console is "no method domReady." Yet another script I wrote runs just fine and if I step through my function, works fine.

Here is the strange part. If I include jquery further up in my file, I get the Twitter object working, but my search http://www.joshkerr.com/search/ stops working. So I suspect some kind of namespace issue going on.

How do I get my Twitter object to work again?

Since It is all client code, you can view source and see for yourself.

It looks like jeesh.min.js may be clobbering jQuery's $ object. Your search page throws the error "Object function h(a,b){return g(a,b)} has no method 'getJSON'". The jeesh.min.js file contains "function h(a,b){return g(a,b)}" and getJSON is a jQuery method, so there you go. I see your search page contains a block like

$(document).ready(function() {
    // Your code here
});

It's usually considered good practice to wrap such code like so

(function($) {
    $(document).ready(function() {
        // Your code here
    });
})(jQuery);

This ensures that $ is actually the jQuery object.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM