Pjax On Yii 1.1.15

I am trying to get pjax working on Yii 1.1.15

The problem is that pjax requires all of the javascript content to be inside files and no inline scripts according

https://github.com/defunkt/jquery-pjax/issues/416

Partly I got fixed it by moving one of the lines loading scripts before loading the html. But still on the first page run gets an error.

And alot of yii javascript code is loaded inline: validation, CGridView and all the CJuiWidget