Can't fix the code of the jQuery section below -
<!doctype html> <html> <head> <meta charset=utf-8> <title>twitter feed</title> <style> body { width: 600px; margin: auto; } ul { list-style: none; } li { padding-bottom: 1em; } img { float: left; padding-right: 1em; } { text-decoration: none; color: #333; } </style> </head> <body> <ul id="biebster-tweets"> <script id="tweets-template" type="text/x-handlebars-template"> {{#each this}} <li> <img src="{{thumb}}" alt="{{author}}"> <p><a href="{{url}}">{{tweet}}</a></p> </li> {{/each}} </script> </ul> <!-- <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <script src="http://cloud.github.com/downloads/wycats/handlebars.js/handlebars-1.0.0.beta.6.js"></script> --> <script type="text/javascript" src="jquery-1.11.3.min.js"></script> <script type="text/javascript" src="handlebars-v3.0.3.js"></script> <script> (function() { var twitter = { init: function( config ) { this.url = 'http://search.twitter.com/search.json?q=' + config.query + '&callback=?'; this.template = config.template; this.container = config.container; this.fetch(); }, attachtemplate: function() { var template = handlebars.compile( this.template ); this.container.append( template( this.tweets ) ); }, fetch: function() { var self = this; $.getjson( this.url, function( data ) { self.tweets = $.map( data.results, function( tweet ) { return { author: tweet.from_user, tweet: tweet.text, thumb: tweet.profile_image_url, url: 'http://twitter.com/' + tweet.from_user + '/status/' + tweet.id_str }; }); // future lessons, research $.deferred, viewers. :) self.attachtemplate(); }); } }; twitter.init({ template: $('#tweets-template').html(), container: $('#biebster-tweets'), query: 'tutspluspremium' }); })(); </script> </body> </html>
this code taken video tutorial of jquery. when author working code, running successfully. when i'm trying use code there showing error here -->
this.url = 'http://search.twitter.com/search.json?q=' + config.query + '&callback=?';
basically, error in url link. how can fix it?? me please..
you're trying use version 1 of twitter api no longer active. you'll need update code use v1.1.
Comments
Post a Comment