Hello People here is my code below,
index.phtml code
<div class="view clearfix" onClick="ajaxinfo()">Info</a></div>
<script>
function ajaxinfo(){
var id = 100;
$.ajax({
type: "POST",
url:"http://localhost/zf2/info/format/html",
data:id,
success:function(data){alert('ajax data success');},
error:function(){alert('ajax data failed to fetch');}
});
return false;
}
</script>
as you can see iam trying to pass id=100 to info.phtml
page and try to get html data back from info.phtml
lets assume info.phtml as
Iam not sure what to write in in controller ... i checked soo many tutorial , but it does not work for ZF2 like
public function init()
{
$ajaxContent=$this->_helper->helper();
$ajaxContent->addActionContext('info','html');
$ajaxContent->initContext();
}
is there any other way to resolve this problem.?