I need to add jQuery and other javascript files to my Zend Framework project. I am trying to do it with an Action controller:-
public function userinfoAction()
{
$this->view->headScript()->appendFile($basePath .'/js/validate_jquary.js');
$this->headScript()->appendFile('http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js');
return new ViewModel();
}
But it is not working.
$this->headScript()in your layout or view? Also, the fact that you have a return statement in your action doesn't look right to me, although I'm not familiar with ZF2, so it may be valid.$this->headScript()in the controller.