好吧,在這裏我堅持了整整一天,以解決即時通訊面臨的問題。讓我來解釋......如何在ajax響應頁面內執行一個包含javascript函數的頁面?
*photo.php - (Main php file)*
….
…. (header goes here…)
….
*<script src="scripts/photogallery.js" type="text/javascript"></script>*
….
…. (ajax refresh script goes here…)
….
**http1.open("GET", "photo_x.php?id1=" + escape(sIdtn1), true);**
….
…. (body/coding goes here…)
….
…. **<script type="text/javascript"> initGalleryScript(); </script> // this script is inside the ajax refresh tag**
….
*Photo_x.php - (ajax refresh file)*
….
…. (coding goes here…)
….
…. **<script type="text/javascript"> initGalleryScript(); </script> // I need to execute this script which is not working currently.**
請幫我找出一個解決方案來執行Ajax響應頁面內的javascript函數...提前
感謝。
通常情況下,ajax響應處理程序可讓您指定'成功'處理程序。這就是你要調用你需要的其他功能的地方。你不指定你正在使用哪個(如果有的話)ajax庫,所以這是最好的。 –