0
我在游戏框架1.3.x的控制器中,我已经定义如下:GET方法播放
public static void plots(Long id) {
//... (Code goes here)
render(list); //Data to render
}
然后在一个单独的HTML文件中的文件夹视图我想“显示”的结果从另一个html文件。我试图通过以下方式来实现:
<script type="text/javascript">
setInterval(function() {
$.get("plots", id, function(${list}){ //I want to give the list needed by the file plots.html
$("#result").html(list); //And then in "result" show the plots obtained
})
}, 1000);
</script>
...
<span id="result"></span>
但它根本不显示任何内容。这个绘图文件只需要这个列表,然后对数据做一个绘图,但我很确定我不是以正确的方式编写代码,我的意思是,我没有给这个函数提供正确的语法或参数。有任何想法吗?谢谢!
PS:我的路线文件
# Routes
# This file defines all application routes (Higher priority routes first)
# ~~~~
# Home page
GET / Application.index
# Ignore favicon requests
GET /favicon.ico 404
# Map static resources from the /app/public folder to the /public path
GET /public/ staticDir:public
# Catch all
* /{controller}/{action} {controller}.{action}
确保您已在HTML头标记 –
包括jQuery的我觉得你的问题是,URL是无效的jQuery。 '“图”对他来说是未知的,而不是有效的URL。我认为您需要查看反向路由https://www.playframework.com/documentation/1.3.x/routes#reverse – tilois
显示您的路线 –