<script type=\"text/javascript\"> $(function(){ $.getJSON('http://www.twitter.com/status/user_timeline/cbullmedia.json?count=10&callback=?', function(data){ $.each(data, function(index, item){ $('.twitter').append('<div class=\"tweet\"><p>' + item.text + '</p></div>'); }); }); });</script>
<!DOCTYPE html><html><head> <script src=\"http://code.jquery.com/jquery-latest.js\"></script> <script> $(document).ready(function(){ $.getJSON('http://www.twitter.com/status/user_timeline/cbullmedia.json?count=10&callback=?', function(data){ var tweets = ''; console.log(data); $.each(data, function(index, item){ tweets += '<div id=\"tweet\"><p>' + item.text + '</p></div>' }); $('#twitter').append(tweets); }); }); </script> <style>div#tweet{ height: 20px; margin: 10px; background: red;}</style></head><body> <div id=\"twitter\"> </div></body></html>
"AlCapone" said:is there anything wrong with this code? When i validate my site this code is the only thing with errors...<script type=\"text/javascript\"> $(function(){ $.getJSON('http://www.twitter.com/status/user_timeline/cbullmedia.json?count=10&callback=?', function(data){ $.each(data, function(index, item){ $('.twitter').append('<div class=\"tweet\"><p>' + item.text + '</p></div>'); }); }); });</script>Note - the code does work as its meant to.Many ThanksChris
Note - the code does work as its meant to.
Many Thanks
Chris
I just ran this.. works fine... basicly the same thing but less resource dependent
Question, Did you call jquery before hand?
where are you validating the code? HTML validation, CSS validation or jQuery validation?
I generally put all my javascript in its own file, but I don't recall ever getting an error for anything I have put in the document head, so long as it's wrapped in script tags.