Поместите это в свой контроллер
public function init()
{
$contextSwitch = $this->_helper->getHelper('contextSwitch');
$contextSwitch->addActionContext('test', 'json')
->initContext();
}
создать тестовое действие
public function testAction()
{
$this->view->var1 = "I'm testing";
}
Затем используйте jquery для выполнения запроса в вашем представлении
<script type="text/javascript">
$(document).ready(function(){
$('#display').ajaxStart(function(){
$(this).html('Loading...');
});
str = $('#test').val();
$('#link').bind('click',function(event){
event.preventDefault();
$.post(
this.href,
{ var1: str, format: 'json' },
function(data){
$('#display').html(data.var1);
},
"json"
);
});
});
</script>
<input type="text" name="test" id="test" value="just testing" />
<p>
<a href="<?php echo $this->url(array('controller' => 'index', 'action' => 'test')); ?>" id="link">Testar</a>
</p>
<div id="display">...</div>