FBJS Ajax加载内容

发布于 2024-08-28 17:00:35 字数 1342 浏览 2 评论 0原文

我尝试了此处的示例之一来加载内容div,但除了显示图像之外,它不显示任何内容。我哪里错了?

文件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>

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. Where I'm going wrong?

File 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:

    <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>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

短叹 2024-09-04 17:00:35

FBJS/Ajax 没有任何问题。这是 quote.php 中的错误。

There was nothing wrong with FBJS/Ajax. It was an error in quote.php.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文