【发布时间】:2013-02-17 18:20:20
【问题描述】:
我希望以下 JavaScript 函数重定向到与我的 routes 文件匹配的 URL。
function getUrl()
{
var hash= $('#hashText').val();
// When the user has not entered a hash, alert to inform them.
if (!hash)
{
alert("Please enter a hash first.");
}
else
{
alert("Redirecting to ... http://localhost:8080/tasks/" + hash);
window.location = "http://localhost:8080/tasks/" + hash;
}
}
这是我的 routes 文件中对应的路由条目。
GET /tasks/:hash controllers.Application.getTask(hash: Int)
但是,这个函数的结果是:
http://localhost:9000/tasks?hash=2014281623
【问题讨论】:
标签: javascript playframework routes