简体   繁体   English

FBJS Ajax加载内容

[英]FBJS Ajax to load content

I tried one of the examples here to load the content in the div, but apart from displaying the image, it doesn't show anything. 我尝试了这里的一个示例来将内容加载到div中,但是除了显示图像之外,它什么也不显示。 Where I'm going wrong? 我要去哪里错了?

File ajax1.js : 文件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);
}

File quote.html : 文件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>

There was nothing wrong with FBJS/Ajax. FBJS / Ajax没有错。 It was an error in quote.php . 这是quote.php中的错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM