PDA

View Full Version : well is any way change TwitterId (with or without reload)???



lse123
12-07-2012, 05:53 PM
<script src="https://api.twitter.com/1/statuses/user_timeline/twitterID.json?callback=updateTweets"></script>
I AM USING THIS TO THE END of the html page for my callback updateTweets retreive lastest tweets... well is any way change TwitterId (with or without reload)???

bernie1227
12-08-2012, 12:38 AM
You could change the src with javascript:
Change the script tag to:


<script src="https://api.twitter.com/1/statuses/user_timeline/twitterID.json?callback=updateTweets" id="tweetsId"></script>

And you can play around with javascript like this:


var twitterId = document.getElementById('twitterId');
twitterId.src = "https://api.twitter.com/1/statuses/user_timeline/twitterID.json?callback=something completely different";

lse123
12-08-2012, 07:27 AM
twitterId.src << this what do? please see callback below...

upon browser see last line on html page I mean the LAST LINE BELOW


<input type="text" list="tweets" id="tweets1" >
</input>
...
...
...
<script src="https://api.twitter.com/1/statuses/user_timeline/twitterID.json?callback=updateTweets" id="tweetsId"></script>

POPULATES THE COMBO HTML5 BOX...

This I want to change is "..twitterID.json..." in

<script src="https://api.twitter.com/1/statuses/user_timeline/twitterID.json?callback=updateTweets" id="tweetsId"></script>

with real twitterID, well?



function updateTweets(tweets) {
//var tweetsSelection = document.getElementById("tweets");


var tweetsSelection = document.createElement("datalist");
tweetsSelection.setAttribute("id", "tweets");

// add all tweets to the tweets menu
for (var i = 0; i < tweets.length; i++) {
tweet = tweets[i];

// create option
var option = document.createElement("option");
option.text = tweet.text;

// strip any quotes out of the tweet so they don't mess up our option
option.value = tweet.text.replace("\"", "'");


// add option to select
tweetsSelection.appendChild(option);
}

document.getElementById("tweets1").appendChild(tweetsSelection);
}

bernie1227
12-08-2012, 07:35 AM
with this"


twitterId.src

can be used to change the src, or in your case the Twitterid.json.


twitterId.src = "https://api.twitter.com/1/statuses/user_timeline/somethingElse";

Will change:


<script src="https://api.twitter.com/1/statuses/user_timeline/twitterID.json?callback=updateTweets" id="tweetsId"></script>

to:

<script src="https://api.twitter.com/1/statuses/user_timeline/somethingElse" id="tweetsId"></script>

lse123
12-08-2012, 10:02 AM
is any way change tweets (twitterID) without refresh of page?