I use the "jsAction" tag to generate ajax url in play framework:
var addToFriendURL = #{jsAction @users.addToFriend(':friendId') /}
The code works fine in html template inside a tag,but i found it's invalid in a external javascript file which i include in the html template.
What was happened when i move the code to a external javascript file ?
Once it is moved to javascript file, it becomes statically served content that the Play server does not parse. Therefore, you have a few options
Personally I would go with option 2, but it may depend on your requirements.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.