I have a Module call ftp_data
. Also I have a js file inside my Module Assets folder bonfire/modules/ftp_data/assets/js/ftp_data.js
.
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="www.example.com"></h3>
</div>
<div class="span3">
<button id="url_btn" name="url_btn" class="btn" type="submit">Search</button>
</div>
</form>
</div>
<!-- Edit by Yesh -->
inside ftp_data.js
$(function(){
$('#search_url').keyup(function(){
var s = new RegExp(this.value.toLowerCase());
$('.result_table .result_row').each(function() {
if(s.test(this.innerHTML.toLowerCase())){
$(this).show();
}else{
$(this).hide();
}
});
});
});
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/
}