The following javascript should setup an interval so a new item from the list of json objects will be added to the top of the list slowly, but instead they are all added at the same time.
<script type="text/javascript">
var json;
var count = 0;
$(document).ready(function() {
$.ajax({
type: "POST",
url: "/Home/PublicTimeLine",
data: "{}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(msg) {
json = eval(msg);
createRow();
}
});
});
function createRow() {
if (count < json.length) {
var data = json[count];
var row = document.createElement("div");
$(row).hide();
row.appendChild(document.createTextNode(data.text));
$(document).find("#results").prepend(row);
$(row).fadeIn("slow");
count++;
setTimeout(createRow(), 3000);
}
}
</script>
<div id="results">
</div>