在 ZF 中,在没有表单的 URL 中将数据从一个操作发送到另一个操作


Send data from one action to another in ZF in URL without forms

我想获取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。