You can't access external pages via javascript because of webbrowser
security. You will have to write a script that gets the .json page and
send that to your user (a proxy).

Tom


On 9/1/10 5:12 AM, jmargey wrote:
> Hi all,
> 
> My first day working on a twitter app, basically I have a web page
> that displays a public feed from a celeb. I am calling
> http://twitter.com/statuses/user_timeline/celebname.json and then
> using jquery to display the feed. Now I know the json exists because
> if I paste the url above in the browser it lets me save the json. If I
> call the json locally from my code http://localhost/test/celebname.json
> it returns the json and I can display the feed, but when I call
> http://twitter.com/statuses/user_timeline/celebname.json it returns
> nothing. Any ideas? Is is to do with the switch to OAuth? Do I have to
> create a twitter app which calls the feed, and the celeb has to
> authorise the app? Even though its a public feed?
> 
> Any suggestions would be great. I posted code below
> 
> $(function () {
>     var html ="";
> 
> /*  I can save the following json but it returns nothing in code */
>     var tweeturl = "http://twitter.com/statuses/user_timeline/
> celebname.json";
> 
> /* this works when json saved locally*/
>     //var tweeturl = "http://localhost/testcelebname.json";;
> 
> 
>     $.getJSON(tweeturl, function (d) {
> 
> 
>         $.each(d, function (i, item) {
> 
> 
>             if (i % 3 == 0 && i != 0) {
>                 html += "</div>";
>             }
> 
>            if (i % 3 == 0)
>            {
>                 html +=  "<div class=\"tweet-items\">";
>            }
> 
> 
>             html += "<div class=\"jeanne-tweet\"><p>" + item.text + "</
> p><div class=\"tweet-date\">" + item.created_at + "</div></div>";
> 
>         });
> 
>         $('#tweet-items').append(html);
>     });
> });
> 

-- 
Twitter developer documentation and resources: http://dev.twitter.com/doc
API updates via Twitter: http://twitter.com/twitterapi
Issues/Enhancements Tracker: http://code.google.com/p/twitter-api/issues/list
Change your membership to this group: 
http://groups.google.com/group/twitter-development-talk?hl=en

Reply via email to