⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

How can I tell if javascript is being called?



richb201
  • profile picture
  • Member

Posted 15 December 2019 - 20:13 PM

I have an app which uses CI and Grocery Crud. I have a php file called javascript_funcs_extension_loaded.php. In it I have:

 

<script language="javascript">

//$this->load->view('javascript_funcs_extensionloaded.js');
<script src="<?= base_url();?>js/javascript_funcs_extensionloaded.js" /></script>
<!--
 

I had hope that this would load the js file. I am using Chrome Devtools and have put a breakpoint in javascript_funcs_extentionionloaded.js. But it never gets fired. What am I doing wrong? I am using Grocery Crud extensvely. Is theere an esier way to call the js file using some GC function?


kevbo75217
  • profile picture
  • Member

Posted 01 April 2020 - 02:53 AM

Add the script into the Grocery Crud theme that you are using. 

 

Example:

 

If you are using bootstrap theme. 

Copy the file to assets/grocery_crud/bootstrap-V4/js

Then go into asset/grocery_crud/bootstrap-v4/js and select the view that you want to use the javascript on eg. Add, Edit, List, or Read. 

At the top where it shows the following 

$this->set_js_config($this->default_theme_path.'/bootstrap-v4/js/form/add.min.js');

Add your javascript and it will load on that view.