简体   繁体   中英

Different JS files for different CI Pages

My codeigniter application has a register page and a login page that both use javascript as there way of submitting their perspective forms. They share a common layout that consists of a header and a footer. The only difference is the javascript code for each of them are different. I'm wanting to find out what methods are available to me that I can have the register page use the register.js and the login page use the login.js file. Any suggestions?

You need to write a helper, which will add the js files dynamically to the header. You can find a more detailed description here .

So basically it appends the js files and css files to a config item. There will be another helper function to write the header section. Call it in your header file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM