我现在已经设法在很长一段时间内完成了一个简单的解析器错误。 我在网上找到了几个代码示例,这些代码看起来很相似 - 我非常感谢一个提示!
$ -> $(".category_modal").click (e) -> alert "Hi" e.preventDefault() $.ajax url: 'entries/detail' type: "GET" <-- Error: Parse error on line 28: Unexpected '{' dataType: 'json' success: (data) -> alert "Hi again" $(".category_modal").html(data)I don't manage to get past a simple parser error for quite some time now. I found several code sample on the web and those seem to be similar - I would deeply appreciate a hint!
$ -> $(".category_modal").click (e) -> alert "Hi" e.preventDefault() $.ajax url: 'entries/detail' type: "GET" <-- Error: Parse error on line 28: Unexpected '{' dataType: 'json' success: (data) -> alert "Hi again" $(".category_modal").html(data)最满意答案
根据您使用的IDE,我发现由于格式错误的空格,我经常会收到编译Coffescript文件的错误。
解决方案:选择'type:'之前的所有空格和前一行末尾的空格,即:'tries / detail'之后
删除它们,然后重新形成它们并再次尝试编译。 特别是当我从其他来源复制粘贴时,会发生这种情况
Depending on the IDE you use, I have found out that oftentimes I get errors compiling Coffescript files due to malformed spaces.
Solution: Select all the spaces before 'type:' AND the ones on the end of the previous line, ie after: 'tries/detail'
Delete them, and form them again and try again to compile. This happens especially when I copy-paste from other sources
更多推荐
发布评论