CoffeeScript - Unmatched OUTDENT(CoffeeScript - 无与伦比的 OUTDENT)
问题描述
我一直在尝试将我的工作 javascript 代码传递给 CoffeeScript,但我无法通过此错误:
I've been trying to pass my working javascript code into CoffeeScript but i can't get pass this error:
第 55 行不匹配的 OUTDENT
unmatched OUTDENT on line 55
这是咖啡脚本代码
$(document).on("click",".save_button", ->
$form = $(this).parent().parent().parent().parent().parent().parent()
$form.bind("ajax:complete", ->
$actionURI = $form.attr("action");
$.get(window.location.protocol+"//"+window.location.host+$actionURI+".js",(data) ->
$form.parent().parent().prev().html(data); //Line 55
closeSaveElement()
,"html")
);
$form.submit();
return false;
);
我已经尝试在任何地方放置和擦除 ;
但我没有什么问题.我也尝试将 ->
更改为 =>
但弹出相同的错误.
i've tried putting and erasing ;
everywhere but i don't whats wrong. I also tried to change ->
for =>
but the same error pops up.
推荐答案
有效的 JS 并不是真正有效的 CoffeeScript.你必须这样做:
Valid JS isn't really valid CoffeeScript. You'd have to do something like this:
$(document).on "click", ".save_button", ->
$form = $(this).parent().parent().parent().parent().parent().parent()
$form.bind "ajax:complete", ->
$actionURI = $form.attr "action"
$.ajax
type: "get"
url: "#{window.location.protocol}//#{window.location.host}#{$actionURI}.js"
dataType: "html"
success: ->
$form.parent().parent().prev().html(data)
closeSaveElement()
$form.submit()
return false
另外,对这一行做点什么:
Also, do something about this line:
$form = $(this).parent().parent().parent().parent().parent().parent()
.closest()
应该会有所帮助.
这篇关于CoffeeScript - 无与伦比的 OUTDENT的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:CoffeeScript - 无与伦比的 OUTDENT


基础教程推荐
- 在 contenteditable 中精确拖放 2022-01-01
- npm start 错误与 create-react-app 2022-01-01
- 如何添加到目前为止的天数? 2022-01-01
- 即使用户允许,Gmail 也会隐藏外部电子邮件图片 2022-01-01
- Bootstrap 模态出现在背景下 2022-01-01
- Fabric JS绘制具有活动形状的多边形 2022-01-01
- fetch 是否支持原生多文件上传? 2022-01-01
- 检查 HTML5 拖放文件类型 2022-01-01
- Bokeh Div文本对齐 2022-01-01
- 原生拖动事件后如何获取 mouseup 事件? 2022-01-01