2012-03-19 200 views
0

可以使用location.reload();重新加載div或表格嗎?使用javascript location.reload()刷新div或表格

我的ajax請求後,我想重新加載只有表部分,而不是整個頁面,因爲我最造型時使用kendo ui和css3時重新加載它擾亂了我不想發生的用戶界面。

+0

不,你不能那樣做。 – Fresheyeball 2012-03-19 01:53:05

+0

把它們放在一個iFrame中? – RobG 2012-03-19 02:53:39

+0

我該怎麼做? – jongbanaag 2012-03-19 02:55:00

回答

1

那麼解決方案是在另一個頁面(jsp/html/php等)中提取該表格/ div。在處理ajax請求的主頁面中,您應該使用html iframe標記包含新創建的頁面:

<iframe src="my_page.html"></iframe> 

現在在JavaScript中,您只能重新加載將刷新您的表的iframe。

document.getElementById(FrameID).contentDocument.location.reload(true); 

你也可以閱讀更多的關於這個從鏈接波紋管教程:

http://www.devarticles.com/c/a/JavaScript/Working-with-IFRAME-in-JavaScript/1/

希望它能幫助。