2011-08-05 93 views

回答

2

使用jQuery UI dialog。嘗試是這樣的:

<div id="loadingDialog" onload="dialogDivLoad()"> 
    <img src="images/loading.png" alt="Loading" /> 
</div> 

而且代碼:

function dialogDivLoad() { 
    $(this).dialog({ 
     modal: true 
    }); // make it modal 
} 

$(function() { 
    $('#loadingDialog').dialog('close'); 
}); 

如果通過AJAX使用jQuery .ajax功能試試這個,而不是檢索數據:

$(function() { 
    $('#loadingDialog').dialog({ 
     autoOpen: false, 
     modal: true 
    }); 
}); 

// somewhere in place of AJAX call 
// show it here 
$('#loadingDialog').dialog('show'); 
$.ajax({ 
    //... 
    complete: function() { 
     // and close here 
     $('#loadingDialog').dialog('close'); 
    }, 
    success: function() { 
     // message, that data loaded 
    }, 
    error: function() { 
     // message, that data loading failed 
    } 
}); 
+0

waoow其巨大的,它的工作。謝謝忍者:-) – chhameed

+0

很高興幫助你:) –