我試圖加載使用AJAX,但加載後的Ajax內容在我的index.html一些網頁sucesfully當我嘗試刷新index.html的話,就說明指數。 html頁面內容,然後我需要點擊鏈接再次加載ajax。刷新完成後頁面的ajax加載內容disapear,它顯示了主要的頁面內容
這裏就是我試圖
<!-- Loading Content -->
<script type="text/javascript">
function load_pages(url) {
$('#project').html('<p><img src="../images/loader/ajax-loader1.gif" width="100" height="19" style="margin: 30% auto 0px 30%;"/></p>');
/*$('#product-content').load(url);*/
/*setTimeout(2000);*//*For Checking loading image*/
$('#project').load(url, "",
function(responseText, textStatus, XMLHttpRequest) {
if (textStatus === 'error') {
$('#project').html('<p style="margin: 30% auto 0 30%;">Unable to load the content...</p>');
}
}
);
}
</script>
<!-- Loading Content End -->
<a href="javascript:void 0" onclick="load_pages('project-1/location.html');">Location</a></li>
這裏是我的問題視頻
這就是它被稱爲ajax的原因(顯示結果不刷新)。 –
但如果我想刷新ajax新鮮的動態內容呢? – Nilesh12