﻿function loadTweets() {

    $.ajax({
        type: "POST",
        url: "http://respeak.net/TwitterService.asmx/GetLatestTweets",
        data: "{}",
        contentType: "application/json; charset=8",
        dataType: "json",
        success: function (result) {
            if (result.d != null && result.d != undefined) {
                $('#divTweet').html(result.d.Text);
//                if (tweets.length > 0) {
//                    // get the first tweet
//                    //alert(tweets[0].Source);
//                    var tweet = tweets[0];
//                    //                    var words = tweets[0].Text.split(" ");
//                    //                    var txt = "";
//                    //                    $(words).each(function (i, w) {
//                    //                        if (w.startsWith("http://") || w.startsWith("https://")) {
//                    //                            words[i] = '<a href="' + words[i] + '">' + words[i] + '</a>';
//                    //                        }
//                    //                        txt = txt + words[i] + " ";
//                    //                    });

//                    $('#divTweet').html(tweets.Text);
//                }
            }

        },
        error: function (xhreq, status, err) {
            alert(xhreq.responseText);
        },
        complete: function (xrq, status) {
        }
    });
    //ReSpeak.Services.TwitterService.GetLatestTweets(GetTweetSuccess, GetTweetFailure, '');
}


function GetTweetFailure(result) {

}
