2010-04-13 119 views
1

我試過其中一個例子here加載div中的內容,但除了顯示圖像,它不顯示任何內容。我哪裏錯了?FBJS阿賈克斯加載內容

文件ajax1.js

function General_Refresh(url,div){ 
    //Showing the load image (pay attention to /> of <img 
    document.getElementById(div).setInnerXHTML('<span id="caric"><center><img src="http://website.name/images/ajax-loader.gif" /></center></span>'); 
    var ajax = new Ajax(); 
    ajax.responseType = Ajax.FBML; 

    ajax.ondone = function(data) { 
     //Hide the loading image 
     document.getElementById('caric').setStyle('display','none'); 
     document.getElementById(div).setInnerFBML(data); 
    } 
    //If there are errors re-try 
    ajax.onerror = function() { 
     General_Refresh(url,div); 
    } 
    ajax.post(url); 
} 

文件quote.html

<script src="http://website.name/scripts/ajax1.js" type="text/javascript"></script> 
    <script type="text/javascript"> 
     <!-- 
     General_Refresh("http://website.name/quote.php","quote"); 
     //--> 
    </script> 

    <div id="wrapper"> 
     <div id="quote"><strong>this</strong></div> 
    </div> 
</div> 
+0

我試過的一件事是,如果我在js文件本身調用general_refresh函數,圖像將繼續顯示。但如果我把它放在html文件中,就像上面這樣做,它會加載一次然後消失。也沒有加載任何內容。該應用程序是空白的。 – input 2010-04-13 16:41:13

回答

0

有什麼不妥FBJS /阿賈克斯。這是quote.php中的錯誤。