我正在尝试使用Ajax发布表单,并根据路由在请求中生成URL字符串。像这样:
$.ajax ({ type: "POST",
url: "@{MyHandlerR objectId}",
headers: {
Accept: "application/json; charset=utf-8",
"Content-Type": "application/x-www-form-urlencoded"
},
...
当我转到/ path / 1时,url在上面的Javascript代码中正确设置为/ newpath / 1。但是,当我转到/ path / 2时,javascript不会重新生成,因此路径保持相同/ newpath / 1。
有没有办法强制重生Julius文件?作为一种解决方法,我可以从html页面中获取URL,但想知道是否有更好的方法来处理这个问题。
谢谢!
答案 0 :(得分:0)
在莎士比亚-js 1.1.4.1中有一个错误被解决了。您可以尝试升级并查看是否能解决您的问题吗?
答案 1 :(得分:0)
我有一个类似的问题,并更新到莎士比亚-Js 1.1.4.1,因为迈克尔建议没有帮助。但是,我不断更新更多的yesod包,现在它可以工作了。这是我的项目的完整依赖项列表,每次请求都会重新编译julius模板:
Dependencies: HTTP-4000.2.5-28d9701af6cb2d10d5070cbf6ed47a59,
aeson-0.6.1.0-cde7af829bbea3ac827694aa2510a102,
attoparsec-0.10.4.0-c391286d724823eaea3d4278acc0acc0,
base-4.5.1.0-66f22db3dfcd87541c9c7e50e7095d26,
blaze-html-0.6.1.1-5eb00422be0277775590b4b29ad45e2d,
bytestring-0.9.2.1-503e91bb155301fdb1956cb5c26ce6e9,
conduit-1.0.7.1-0511660e512a3cec04b33c5b7f2daf7d,
containers-0.4.2.1-75f143aa39a3e77a1ce2300025bdd8ce,
data-default-0.5.3-f33230611d35c41f344389ab4c476cef,
deepseq-1.3.0.0-c26e15897417ecd448742528253d68f6,
directory-1.1.0.2-90bfc47dbd5ac1313aec9ce76cc22338,
either-3.4.1-ca49211a7bff3ee6dad5964300774fcb,
enumerator-0.4.19-691bfc79b1307f260c3bed7c660ca787,
errors-1.4.2-38b5cc57662a4d7758cb0b7a98e5e95d,
fast-logger-0.3.1-b31c6f4545741767ef9f0c1e7aabb95e,
hamlet-1.1.7.2-3b72b7ddc47a000199206c749f99daa2,
hjsmin-0.1.4.1-8d8e0263b0d13644d39a144b315f013a,
http-conduit-1.9.4.1-a32be4840c47c665bdc8200d735b893a,
http-types-0.8.0-abf1cc745dc88f49ff33fda44d95c935,
mime-mail-0.4.2-1a1836fcf5a352b8c5067c2fbefa5724,
monad-control-0.3.2.1-325c196d0e82ae0923fc262c7eb5203d,
monad-logger-0.3.1.1-70025dd5d4d9f30a2c319311fc1ec3bd,
mtl-2.1.2-02e701f9b1590ee88a0b5b0bd5d93a29,
network-2.3.1.0-efa1c7220c576804829351b700849052,
old-locale-1.0.0.4-5e45cabd3b4fdcad9e353ea3845f5ef7,
persistent-1.2.1.1-d16c0d7db2515b5e51bb89a0a5433a18,
persistent-postgresql-1.2.1-56f1e8c317aef2e3d1e3bd0810347412,
persistent-template-1.2.0.2-49786c54b7c951e49542bdc0d39701fb,
regex-posix-0.95.2-417a70abf4122fdc399910fd04439ecf,
safe-0.3.3-2e88224aa98500bc4dcbbdfb58ba6a17,
semigroups-0.9.2-c48ab2744f6565641b443c955b76d44a,
shakespeare-css-1.0.6.3-4a394d9b2a18d7c964cebd070ad5cbb1,
shakespeare-js-1.2.0-81b96be286c5d969c9de5482d85833ca,
shakespeare-text-1.0.0.7-47944e312bdeaf894287cd643ad6847a,
shelly-0.15.4-e747484ce18c0ac32c90b75094585c4a,
statistics-0.10.2.0-b106f61bbe0b7932af82166a17322bb1,
statistics-linreg-0.2.3-7b846159150793fda8df72a61d5001c1,
template-haskell-2.7.0.0-ea0103105685f73dfd311f959f3ec5a5,
text-0.11.2.3-db61832d0c4660614c4ceff234ed4abb,
time-1.4-d61e2caaa0486655b4e141dc277ed49f,
timezone-olson-0.1.2-960d8681a104c77e1f332052889a5d4b,
timezone-series-0.1.2-e065f94ccc32d05a0523bd76236bf2d2,
vector-0.10.0.1-3450daae3d9f2092020075d05481123c,
wai-extra-1.3.4.2-be3d9d5535ba845aa5d00d77a2741583,
warp-1.3.9-b3d12eb3e1e49c3caa7df53ab3975ece,
xml-1.3.12-ff3424b78e3e19078e5d410d6cd49c60,
yaml-0.8.3-c6a9d3a303a1ae9b01903ad3831cfcb9,
yesod-1.2.2.1-0504dfba238cb1072923a349a994f5e4,
yesod-auth-1.2.3-16d2d9be37fa167a7b64e182579ad640,
yesod-core-1.2.4.3-b960ca223bbb7b1e47ef3698e4c90141,
yesod-form-1.3.2.2-6890d228f722c380dc5bb1d599a8d584,
yesod-static-1.2.0.1-338a66214147e472ce3d0e7db90e1175
附录:以下是我的cabal文件中的依赖项:
build-depends: base >= 4 && < 5
--, yesod-platform >= 1.2 && < 1.3
, yesod >= 1.2 && < 1.3
, yesod-core >= 1.2 && < 1.3
, yesod-auth >= 1.2 && < 1.3
, yesod-static >= 1.2 && < 1.3
, yesod-form >= 1.3 && < 1.4
, bytestring >= 0.9 && < 0.11
, text >= 0.11 && < 0.12
, persistent >= 1.2 && < 1.3
, persistent-postgresql >= 1.2 && < 1.3
, persistent-template >= 1.2 && < 1.3
, template-haskell
, hamlet >= 1.1 && < 1.2
, shakespeare-css >= 1.0.6.3 && < 1.1
, shakespeare-js >= 1.2.0 && < 1.3
, shakespeare-text >= 1.0 && < 1.1
, hjsmin >= 0.1.4 && < 0.2
, monad-control >= 0.3 && < 0.4
, wai-extra >= 1.3 && < 1.4
, yaml >= 0.8 && < 0.9
, http-conduit >= 1.9 && < 1.10
, directory >= 1.1 && < 1.3
, warp >= 1.3 && < 1.4
, data-default
, aeson
, conduit >= 1.0
, monad-logger >= 0.3
, fast-logger >= 0.3
更新依赖项版本并执行cabal update
和cabal install --force-reinstalls
,它应该有效。