延迟加载带有 jQuery 问题的网页部分
我有一个带有 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您尝试加载的 xHTML 不是有效的 xHTML。
它以文档类型声明开头,但没有“html”、“body”或“head”标签。
尝试删除文档类型,或放入所有这些标签。
如果添加这些标签,则可以通过向 jQuery 提供所需元素的 ID 来删除它们:
查看 .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:
Look at the jQuery Documentaion for .load. Look for the heading "Loading Page Fragments".