yeshansachithak yeshansachithak - 1 year ago 158
PHP Question

load js file to view in ci bonfire

I have a Module call

. Also I have a js file inside my Module Assets folder
Now I want to load this file to my view

Inside View

<!-- Edit by Yesh -->
<div class="container-fluid">
<form method="POST" id="url_finder" name="url_finder">
<div class="span4">
<h3>Search URL : <input type="search" id="search_url" name="search_url" placeholder=""></h3>
<div class="span3">
<button id="url_btn" name="url_btn" class="btn" type="submit">Search</button>
<!-- Edit by Yesh -->

inside ftp_data.js

var s = new RegExp(this.value.toLowerCase());
$('.result_table .result_row').each(function() {

Answer Source

Finally I found the solution. This is what I found. I hope it will help you too.

public function index()
//---functions will goes here
//--Add this code before closing public function index
Assets::add_module_js('ftp_data', 'ftp_data.js');
//--ftp_data is the Module name. 
//--ftp_data.js is the name of the js file that is inside the module/assets/js/
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download