I have the following code:
var twitterUrl = escape("http://api.twitter.com/1/statuses/user_timeline.json?screen_name=" + username);
$.ajax({
type: "GET",
url: "twitter.js?url=" + twitterUrl,
dataType: "json",
success: function(d, status, req) {
var tweets = eval('(' + d + ')');
showTweets(tweets);
}
});
I want the twitter.js file to get the twitterUrl variable and process it to obtain the json file generatd by the twitter API. The questions are:
- How can I read and parse the twitterUrl in the twitter.js file?
- How can I simulate a
stream_get_contentsPHP function in JavaScript to parse and process the twitter link and pass the result back to the original page?
1.
2.
Where
myMethodis the function you want to send the data to:So for example
myMethod: