我对 Web 开发很陌生,并且遇到了一些语法问题。我有两个textarea
。用户在 中输入信息后textarea
,他/她将按下execute-button
,它应该将这两个数据传递textarea
给 acontroller
进行一些数据处理。我正在使用 Play 2.1 框架。这是我的代码片段:
<h2>First Serial</h2>
<textarea id="firstSerial" style="width:600px;height:50px"></textarea><br/>
<h2>Second Serial</h2>
<textarea id="secondSerial" style="width:600px;height:50px"></textarea><br/><br/>
<script>
function grabTheSerials() {
var firstSerial = document.getElementById('firstSerial').value;
var secondSerial = document.getElementById('secondSerial').value;
location.href="@routes.App.function(" + firstSerial + ", " + secondSerial + ")";
}
</script>
<input type="button" value="execute-button" onclick="grabTheSerials()"/>
代码实际上并没有传递变量。我做了控制台调试,它实际上只是通过了+firstSerial+
。我能做些什么来解决这个问题?