【问题标题】:Reload the html to display the info重新加载 html 以显示信息
【发布时间】:2017-10-19 08:19:01
【问题描述】:

我有一个 html5 网页,可以读取 xml 并在其中显示信息。该页面是用 jquery 编写的。

这是我的 xml:xml

这是我的 html5:html

我可以完美地阅读 html5(这对我来说很难),但是当我想显示它时,我必须重新加载页面才能看到信息,因为一开始我什么也看不到! :(

有人可以帮帮我吗? 非常感谢!

附言我通常在 Firefox 上打开它,因为 safari 和 chrome 不打开它。 (我想是因为我的配置)

var xml;
$(document).ready(function(){
    $.ajax({
        type: "GET",
        url: "base_es.xml",
        dataType: "xml",
        success: xmlParser
    });
});
//loading XML file and parsing to .main div.
function xmlParser(data) {
    xml = data;
    $('#load').fadeOut();
    $(xml).find("fac").each(function () {
    name = $(this).attr("id");
    name2 = $(this).find("esc").text();
    var curso = $(this).find("curso").text();
    $("#list").append("<li><a href='hor3.html?id=" + name + "'data-transition='slide'><h3  id='name'>" + name + "</h3></a></li>");
    }); $('#list').listview('refresh');
} 

【问题讨论】:

  • 显示的代码中没有任何内容会导致问题...控制台中是否抛出错误?
  • 当我从上一个页面转到那个页面时出现问题,例如这是上一个:dl.dropbox.com/u/12291198/index.html,当我点击通知时,我必须重新加载数据才能看到新闻。

标签: jquery html xml ajax


【解决方案1】:

好的,我看到我可以使用location.reload();top.location.href='hor2.html'; 重新加载页面

【讨论】:

    猜你喜欢
    • 2015-01-29
    • 1970-01-01
    • 1970-01-01
    • 2012-01-14
    • 1970-01-01
    • 1970-01-01
    • 2020-02-05
    • 2015-08-14
    • 2019-03-25
    相关资源
    最近更新 更多