In my development I put all the ajax code inside my CHtml tags. I have given example below , Like this I have lot of Java script, Jquery and ajax calls in the code . I don’t find a way to separate them now … . Do we have to separate that code to separate java script files to speed up the application ? I read it in our forums somewhere there is a way to separate them … Could you please throw some light on this? Thanks for your help
You can use CClientScript to register javascript code via registerScript() or registerScriptFile() if you want to separate it away into files: Take a look at the docs here CClientScript
Thanks for your response Haensel . Yes I used this to include external script and my JSP files. But to separate the already written ajax code automatically ? I mean already code is written ,do I have to manually separate and write JS files and register them …?
Thanks for your response wisp. I was not knowing this . This definitely helps .Could you please let me know where I have to copy the "site/index.js " files ? I mean controller/method name JS files full path …
I know this is too much to ask , is there any way to separate the already written ajax code automatically ? I mean already code is written ,do I have to manually separate and write JS files …?
Again for the below example code , Do I have to manually write corresponding AJAX JS code ( To remove the ajax code from here ) and move it to the JS files ? Any easy way to separate them ?
Thank You bennouna for your reply . Yes , I am doing view source of the page and copying all the java script in separate files . Not sure this is the best way to do it .