當jqtouch中構建一個iphone web應用程序時,通過鏈接加載內容(「a」標籤),然後jqtouch解析下一頁上的任何內容並初始化任何鏈接。但是,當我通過AJAX調用加載內容並將它加載到元素時,那麼該內容中的任何鏈接都不會被jqtouch初始化。因此,對這些鏈接的任何點擊都是對新資源的全面點擊,並且不會由jqtouch處理,所以此時您已經有效地打破了jqtouch。在AJAX加載內容中初始化jqtouch中的鏈接
我的AJAX代碼是:提前
#data
<script type="text/javascript">
$.ajax({
url: '/mobile/nearby-accounts',
type: 'GET',
dataType: 'html',
data: {lat: lat, lng: lng},
success: function(html) {
$('#data').empty().append(html);
// Is there some method I call on jqtouch to have any links in $('#data') be hooked up to the jqtouch lifecycle?
}
</script>
感謝。
免責聲明:我正在使用舊版本的jQTouch ...所以可能有新的API來做到這一點。剛注意到這是一個老問題。 – Ephraim 2011-03-24 02:22:32