延迟加载带有 jQ​​uery 问题的网页部分

发布于 2024-11-28 23:40:10 字数 527 浏览 3 评论 0原文

我有一个带有 div id="rate" 的网页。我想在使用 jQuery 加载页面后加载此 div 的内容。
查询时,我的服务器返回一个有效的 xhtml 文档(内容类型为“application/xhtml+xml”),其中包含速率 div 的内容。

我已经尝试过:

$('#rate').load('/wizard/false', function() {
    $("#rate").show("slow", function () {} );
});

以及 $.get - 似乎没有任何效果。我不断收到指定了无效或非法字符串" code: "12 或层次结构错误(在所有浏览器上)。
当我将内容直接手动放置在速率 div 中时,一切正常。
您可以在此处查看有问题的页面。

I have a webpage with a div id="rate". I want to load the content of this div after the page is load with jQuery.
When queried, my server returns a VALID xhtml document (with a content type of "application/xhtml+xml") with what should be the contents of the rate div.

I have tried:

$('#rate').load('/wizard/false', function() {
    $("#rate").show("slow", function () {} );
});

As well as $.get - nothing seems to work. I keep getting An invalid or illegal string was specified" code: "12 or hierarchy error (on all browsers).
When I place the content manually directly in the rate div, everything works fine.
You can check out the problematic page here.

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

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

发布评论

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

评论(1

独﹏钓一江月 2024-12-05 23:40:10

您尝试加载的 xHTML 不是有效的 xHTML。

它以文档类型声明开头,但没有“html”、“body”或“head”标签。

尝试删除文档类型,或放入所有这些标签。

如果添加这些标签,则可以通过向 jQuery 提供所需元素的 ID 来删除它们:

$('#rate').load('/wizard/false #rating-wizard', function(data) {
    // Do whatever you want
});

查看 .load 的 jQuery 文档。查找标题“加载页面片段”。

Your xHTML that you are trying to load is not valid xHTML.

It starts with a doctype declaration, but has no 'html', 'body' or 'head' tags.

Try either removing the doctype, or putting in all those tags.

If you add those tags, you can then strip them by providing jQuery with the ID of the element that you want:

$('#rate').load('/wizard/false #rating-wizard', function(data) {
    // Do whatever you want
});

Look at the jQuery Documentaion for .load. Look for the heading "Loading Page Fragments".

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