Rails Partials 无法在 IE 中加载 jQuery
我正在使用 jQuery 告诉 Rails 渲染部分内容。这在 Firefox 和 Safari 中工作得很好,但是当我清理 Windows 机器上的灰尘以在 IE8 或 IE9 中进行测试时,没有呈现任何内容。
这是 jQuery:
$('#content').append("<%= escape_javascript(render :partial => "my_karma", :locals => {:list_id =>"my"}) %>");
我需要修改一些东西才能让 IE8 或 IE9 渲染这些东西吗? Rails 或 IE 不会抛出任何错误,只是没有显示出来。 Rails 日志甚至显示正在渲染的文件。
非常感谢任何帮助。如果您需要更多信息,请询问。我会提供一切我能提供的。
I am using jQuery to tell Rails to render a partial. This works fine in Firefox and Safari, but when I dust off my Windows machine to test in IE8 or IE9, nothing is rendered.
Here is the jQuery:
$('#content').append("<%= escape_javascript(render :partial => "my_karma", :locals => {:list_id =>"my"}) %>");
Is there something I need to modify to get IE8 or IE9 to render this stuff? No errors are being thrown by Rails or IE, it just simply is not showing up. The Rails log even shows the files getting rendered.
Any help is greatly appreciated. If you need more information, just ask. I will provide whatever I can.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您能否向我们展示
respond_to
块以及对此 JS ERB 的初始调用?我最初的猜测是浏览器可能没有使用正确的
dataType
或者渲染本身存在问题(包括完整布局或类似的内容)。Can you show us the
respond_to
block as well as perhaps the initial call to this JS ERB?My initial guess is perhaps the browser isn't using the correct
dataType
or there's a problem with the render itself (including full layout or something along those lines).使用类型注释的问题
事实证明,这是在我的 js.erb 文件中 。我用 // 类型注释替换了它们,问题就消失了。
This turned out to be a problem with using
type comments in my js.erb file. I replaced them with // type comments and the problem went away.