public static string JSSitting() { OrderSittingBusiness orderSittingBussiness = new OrderSittingBusiness(); List <OrderSitting> ListorderSitting = new List <OrderSitting>(); ListorderSitting = orderSittingBussiness.GetList(""); string phone = "['"; string mytimeAgo = "['"; string people = "['"; string country = "['"; string Result = ""; foreach (OrderSitting re in ListorderSitting) { phone += re.SDT + "','"; mytimeAgo += re.TimeNote + "','"; people += re.FullName + "','"; country += re.City + "','"; } try { phone = phone.Substring(0, phone.Length - 3); mytimeAgo = mytimeAgo.Substring(0, mytimeAgo.Length - 3); people = people.Substring(0, people.Length - 3); country = country.Substring(0, country.Length - 3); } catch { } phone += "']"; mytimeAgo += "']"; people += "']"; country += "']"; Result += "$(function () { " + "setInterval(function () { " + " $('#someone-purchased > div:first') " + " .fadeOut(200) " + " .next() " + " .fadeIn(0) " + " .end() " + " .appendTo('#someone-purchased');" + "var phone =" + phone + ";" + "var mytimeAgo =" + mytimeAgo + " ;" + " var people =" + people + ";" + " var country =" + country + ";" + " var randomlytimeAgo = Math.floor(Math.random() * mytimeAgo.length);" + " var randomlytimeAgo1 = Math.floor(Math.random() * people.length);" + " var randomlytimeAgo2 = Math.floor(Math.random() * country.length);" + " var randomlytimeAgo3 = Math.floor(Math.random() * phone.length);" + " var currentmytimeAgo = mytimeAgo[randomlytimeAgo];" + " var currentpeople = people[randomlytimeAgo1];" + " var currentcountry = country[randomlytimeAgo2];" + " var currentphone = phone[randomlytimeAgo3];" + " $(\".timeAgo\").text(currentmytimeAgo + \" trước\");" + " $(\".people\").text(currentpeople);" + " $(\".country\").text(currentcountry);" + " $(\".phone-order\").text(currentphone);" + " }, 20000);" + " setInterval(function () {" + " $('#someone-purchased').fadeIn(function () { $(this).removeClass(\"fade-out\"); }).delay(5000).fadeIn(function () { $(this).addClass(\"fade-out\"); }).delay(5000);" + " }, 20000);" + " });"; return(Result); }