$(document).ready(function() {
    DoAjax('getmbatabtweets','#MbaTabTweets');
    DoAjax('getmembertabtweets','#MemberTabTweets');
});


function DoAjax(serviceMethodName,divID)
{
    $.ajax({
    type: "POST",
    url: "/webservices/Massbar/MBATwitterService.asmx/" + serviceMethodName,
    data: "{}",
    contentType: "application/json; charset=utf-8",
    dataType: "json",
    error: function(xhr, status, error) {
        // Boil the ASP.NET AJAX error down to JSON.
        var err = eval("(" + xhr.responseText + ")");
        ShowTweet(divID,err.Message);
      },
    success: function(msg) {

    if (msg.hasOwnProperty("d"))
      // Leave the .d behind and pass the rest of 
      //  the JSON object forward.
      ShowTweet(divID, msg.d);
    else
      // No .d; no transformation necessary.
      ShowTweet(divID, msg);
   }
  });
}


function ShowTweet(divID,msg)
{
    $(divID).removeClass('asynchLoading');
    $(divID).html(msg);
}
