c# - How to RETWEET, REPLY or add a tweet to Favorite? -


i trying implement retweet , reply functionality in site in sharepoint 2010. creating web part , trying fetch tweets particular hash tags.

i able hash tag data here have put retweet, reply , favorite buttons on every tweet. trying retweet right , javascript code looks this:

$.getjson("http://search.twitter.com/search.json?q=%23" + hashtag + "&rpp="+ nooftweets +"&&callback=?", function (msg) {             container.html(''); //remove loading gif             (i = 0; < msg.results.length; i++) { //build divs containing tweets , add container div                 var str = '<div class=\'tweet\'><div class=\'avatar\'><img src="' + msg.results[i].profile_image_url + '" alt=\'twitter-img\'/></div>';                 str += '<div class=\'status-body\'><a href="http://twitter.com/' + msg.results[i].from_user + '"target="_blank">' + msg.results[i].from_user + '</a>';                 str += '<div>' + formattwitstring(msg.results[i].text) + '</div></div>';                 str += '<div class=\'created_at\'>' + relativetime(msg.results[i].created_at) + '</div>';                 str += '**<div><a href="http://api.twitter.com/1/statuses/retweets/' + msg.results[i].id_str + '" target=_blank>retweet</a></div>**</div>';                 container.append(str);             } 

but retweet code not working properly.. please me in rectifying problem.

thanks in advance.


able now.. have added line of code in getjson. working fine.. redirecting user twitter. if user logged in won't ask credential else open twitter login page.

$.getjson("http://search.twitter.com/search.json?q=" + repvalue + "&rpp="+ nooftweetslength +"&&callback=?", function(msg) { (i = 0; < msg.results.length; i++) { //build divs containing tweets , add container div str = ''; str += '' + msg.results[i].from_user + ''; str += '' + formattwitstring(msg.results[i].text) + ''; str += '' + relativetime(msg.results[i].created_at) + ''; str += 'reply '; str += ' retweet '; str += ' favorite'; container.append(str); } });

  1. where's container defined?
  2. since it's html in text:

    container.innerhtml = str;

  3. use double quotes instead of single quotes don't need escaping

  4. consider using jquery or library construct elements instead of html shown. makes easier read.
  5. be sure format of msg parsed object before working it.

Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -