非法字符,Javascript

发布于 2024-07-27 22:53:32 字数 297 浏览 3 评论 0原文

我正在尝试通过 Rails 应用程序运行 jquery。 我在弹出窗口中有编辑信息,我想更改它以在单击更新后显示信息。 它应该可以工作,但是这条线

$(".edit_business).append("<%= escape_javascript(render(:file => 'businesses/show')) %>");

引发了非法字符问题。 此代码位于我的 update.js.erb 文件中。 escape_javascript 在那里,但它在我的控制台中抛出错误。

I am trying to run jquery through a rails app. I have the edit information in a popup window and i want to change that to show information after they click update. It should work but this line

$(".edit_business).append("<%= escape_javascript(render(:file => 'businesses/show')) %>");

is throwing an illegal character issue. This code is in my update.js.erb file. The escape_javascript is there but it's throwing an error in my console.

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

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

发布评论

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

评论(4

纵山崖 2024-08-03 22:53:34

你真的错过了那句话吗?

$(".edit_business").append(...)

Are you actually missing that quote?

$(".edit_business").append(...)
暮倦 2024-08-03 22:53:34

您缺少 $(".edit_business") 中的报价

You're missing a quote in $(".edit_business")

呆橘 2024-08-03 22:53:34
(".edit_business)

应该是

(".edit_business")
(".edit_business)

shoud be

(".edit_business")
小猫一只 2024-08-03 22:53:34

我经常只使用 render(:file => filename).to_json

I often just use render(:file => filename).to_json

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