我认为@{SomeRouteR}
应该在.julius
文件中工作,如下所述:
https://www.yesodweb.com/book/shakespearean-templates#shakespearean-templates_julius_javascript
当我第一次在我的处理程序中使用它时,一切正常:
toWidget [julius|
$("#examplespan").click(function(){
$.ajax({
url: @{ExampleR},
type: "POST",
...
|]
但现在我已经改变了我的处理程序,让它像这样工作:
$(widgetFile "example")
我在以下代码中添加了此代码example.julius
:
$("#examplespan").click(function(){
$.ajax({
url: @{ExampleR},
type: "POST",
...
我现在得到错误:
[Error#yesod-core] expected EUrl but got Nothing for: DerefIdent (Ident "ExampleR")
CallStack (from HasCallStack):
error, called at ./Text/Shakespeare.hs:441:27 in shakespeare-2.0.20-3iMfZ8A5DXH3Twhu6IoWNc:Text.Shakespeare @(yesod-core-1.6.9-7g4SwkDmJJ261rdNBKrLzX:Yesod.Core.Class.Yesod ./Yesod/Core/Class/Yesod.hs:662:5)
我究竟做错了什么?