• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
My js code from template runs two tiems

#1
[eluser]Dominiq[/eluser]
Hey I have problem with my js code that is in CI template. He runs two times instead of one time. This is my test example:
Code:
[removed]
$(document).ready(function() {
console.log('php');
});
[removed]
In firebug console I see this:
Code:
>js
>php
>php
"js" is log from my js file. I was checking what will be executed first.

This part of js code is in template that is returned as a string:
Code:
$string = $this->load->view('myfile', '', true);
Then this $string is printed by echo in another template that is sent directly to browser:
Code:
$this->load->view('blogview', $data);

I don't have idea why it is like this. Maybe because template in template? Or because that I did retuned first template as string?

#2
[eluser]Dominiq[/eluser]
Problem solved. I did buy template from theme forest. I did look that they are getting one atribute and put in in other via js.
Post closed.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.