我想获取a.phtml
上的文本框的数据,并且接收操作是b
的,并且通过使用应该在a.phtml
中的超链接来b.phtml
其视图。我怎么能得到这个。
例
a.phtml
<input type='text' id='username' name="username">
<a href="b">hassan</a>
b.phtml 将是一个 iframe如何通过此方法获取文本框的值。
如果我能够理解你的问题。您可以创建一个javascript
function
并从锚标记调用该。
function myfunction(){
var name = $('#username').val();
// use ajax here to pass your values to different action
// or if just want to redirect with data then
window.location.href = '/controller/action/param/'+ name;
}
<input type='text' id='username' name="username">
<a href="javascript:void(0)" onclick="myfunction()">hassan</a>
不确定你是否使用jquery。