Question: I have made a code in javascript/jquery which populates a division with tweets of a specific handle.

```
$.getJSON("http://api.twitter.com/1/statuses/user_timeline.json?screen_name="+ handle + "&count=" + noOfTweets + "&include_rts=true&callback=?", function(data) {
    //some code
});

```

Here is the code to display the tweets

```
Json.parse(data);
$.each(data, function(i, tweet) {
  var buttonString = '<br/><a onclick="retweet('+tweet.id+')">Retweet</a>'
                            +'<a onclick="favorite('+tweet.id+')">Favorite</a>';

  $("#tweets").append($("<li/>").html(tweet.text+" <span class='tweetTime'>--a moment ago.</span>")+buttonString);
}

```

I now want to add retweet and favorite buttons to the tweets.
The twitter api for the above functions require a post request, but jquery doesn't have any .postJSON() function
<https://dev.twitter.com/docs/api/1/post/statuses/retweet/:id>
and
<https://dev.twitter.com/docs/api/1/post/favorites/create/:id>

so what should my retweet and favorite functions contain?
Some help please.

Answer: 
I would suggest something like a JSON based REST full API. 

This makes your API language independent.

Once the API is made then you can make client libraries in popular languages.
I'm using a URL to request the JSON:

```
api.example.com/api.php?action=User.login&username=admin&password=111

```

The JSON response is:

```
{
   "resultcode":100,
   "resultdata":{
      "id":"1",
      "username":"admin",
      "password":"$1$$TUPijxhaACBBZHMowbtgD.",
      "name":"chenwendong",
      "email":"mdowen@foxmail.com",
      "sex":"\u7537",
      "age":"11",
      "phone":"15811111111",
      "address":"\u5317\u4eac\u7231\u7231\u7231\u554a\u554a\u554a\u554a\u554a\u554a\u554a\u554a\u554a\u554a\u554a\u554a\u554a\u554a\u554a\u554a\u554a\u554a\u554a\u554a\u554a\u554a\u554a\u554a\u554a",
      "province_id":"1",
      "city_id":"1",
      "last_login_ip":"127.0.0.1",
      "last_login_time":"2012-05-07 17:32:55",
      "state":"1",
      "intime":"2012-05-07 09:49:11",
      "is_deleted":"0",
      "province":"\u5317\u4eac\u5e02",
      "city":"",
      "sid":"fcd6321c4cd4748a0cee2e7cc337506b",
      "uid":"1",
      "message_count":"11"
   }
}

```

Then, someone can use Android JSON to decode it.