0
我通過了jQuery Mobile的1.3 API文檔事件處理讀,有點失去了相應的事件使用。加載動態JSON數據jQuery Mobile的事件
基本上,我想我的應用程序加載我的博客帖子的加載成像時,其首先使用AJAX推出。我只能認爲以下事件,但不知道哪種最適合我的需要:
$(document).on('pagecreate' , '#blogposts', function() {
$.ajax({
//Get data from server
});
});
$(document).on('pagebeforecreate' , '#blogposts', function() {
$.ajax({
//Get data from server
});
});
$(document).on('pagebeforeload' , '#blogposts', function() {
$.ajax({
//Get data from server
});
});
$(document).on('pagebeforeshow' , '#blogposts', function() {
$.ajax({
//Get data from server
});
});
$(document).on('pagecreate' , '#blogposts', function() {
$.ajax({
//Get data from server
});
});
$(document).on('pageinit' , '#blogposts', function() {
$.ajax({
//Get data from server
});
});
$(document).on('pageshow' , '#blogposts', function() {
$.ajax({
//Get data from server
});
});
我的理解,從SO是有技術上使用的document.ready – Chelseawillrecover
如果你把你的JS在頁面的底部的時候有輕微的性能影響它加載和運行從頂部到底部,文檔已經被加載。我沒有看到任何不使用'$(document).ready'的理由,除非你實際上有**明顯的**性能問題。 – slessans