我正在使用jquery mobile並希望在特定的時間間隔內刷新div。 我嘗試使用每10秒自動加載並刷新div jquery mobile
var auto_refresh = setInterval(function() {
$("#zabar").load(location.href+" #zabar>*","").fadeIn("slow")
},15000);
,但會發生什麼該分區或按鈕的CSS樣式和結構調查時自動刷新後消失。 我不加載其他頁面的內容。只想在特定時間刷新它。 這是演示這裏發生了什麼http://jsfiddle.net/pRTg9/每一件事消失
這可能有助於http://jsfiddle.net/kLk4f/1/相關:http://stackoverflow.com/questions/9338824/how-to-calculate-the-remaining-left-time-with -php-and-mysql/9338894#9338894 – 2012-03-09 01:36:38
@Phill Paffor我真的很抱歉,jsfiddle沒有打開。必須稍微等一下。 或者請將代碼粘貼到pastebin上,謝謝 – 2012-03-09 01:47:35
@BasicBridge不只是你。 [here](http://techoctave.com/c7/posts/60-simple-long-polling-example-with-javascript-and-jquery)是一段很好的閱讀。 fyi,你想要的是所謂的「長輪詢」。 – Shea 2012-03-09 02:42:13