Hi, I am urgently looking for solution for implementing the Application Scenario(twitter). I wouldnt wan't to hard code to search for the keywords for the tweets.
But i want to pass in from a textbox/Session. Need help urgently.
Regards
But i want to pass in from a textbox/Session. Need help urgently.
Regards
<
script
type
=
"text/javascript"
>
var $ = $telerik.$;
function GetTweetes(keywords, numPosts, fnk) {
var url = "http://search.twitter.com/search.json?q=" + keywords + "&rpp=" + numPosts + "&callback=?";
$.getJSON(url, function(data) {
if ($.isFunction(fnk)) {
fnk.call(this, data.results);
}
});
}
function OnClientShowing(sender, args) {
GetTweetes("Ajax", 10, function(data) {
var rotator = $find("<%= tweetsRotator.ClientID %>");
var currentItems = rotator.get_items();
//scroll the rotator to the first item
rotator.set_currentItemIndex(0);
$(data).each(function(i, post) {
//if there is such an item created already - simply replace the content with the latest one
var dataItem = data[i];
var htmlString = "<
div
class
=
'wrapper'
>" + "<
img
class
=
'profilePic'
src
=
'" + dataItem.profile_image_url + "'
></
img
>" + "<
div
class
=
'text'
>" + dataItem.text + "</
div
><
div
class
=
'date'
><
span
class
=
'author'
>" + dataItem.from_user + " | </
span
>" + dataItem.created_at + "</
div
></
div
>";
if (currentItems[i]) {
currentItems[i].get_element().innerHTML = htmlString;
}
else {
//create and add a new item in case there is no such in the rotator - e.g in this demo this will be needed only on first show but in more complex scenario, when the returned by twitter records have different length
var radRotatorItemData = {};
radRotatorItemData.Html = htmlString;
rotator.addRotatorItem(radRotatorItemData, i);
}
});
});
}
function ShowNotification() {
var notification = $find("<%= RadNotification1.ClientID %>");
notification.show();
}
</
script
>