Yii Framework Forum: Javascript is not getting registered - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Javascript is not getting registered

#1 User is offline   callmesid 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 51
  • Joined: 26-November 16

Posted 05 March 2018 - 07:52 AM

Hello Experts,

I am using Yii2 Version 2.0.9 on Windows7 XAMPP. I am trying to register my javascript but it is not getting some strange issue.

I have included the "myFunction.js" inside web/js folder. Then I have included in the AppAsset.php as below:

public $js = [
        'js/timer.js',
        'js/myFunction.js',
    ];

Now the issue is when I trying to use this "myFunction.js" from my view file it is not functioning. But when I trying to find through "Inspect Element" I can see the
<script src="/js/timer.js"></script>
<script src="/js/myFunction.js"></script>
.
But when I am trying to access it through localhost/js, I can only able to see
'js/timer.js',
.

I am able to use timer.js but myFunction.js is not working in view page.

Any idea for this issue??

Thanks in advance.

Regards,
Sid
0

#2 User is offline   alrazi 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 1,546
  • Joined: 08-August 12
  • Location:Durban, South Africa

Posted 06 March 2018 - 01:10 AM

hard to point to what is wrong, but you could double check your file names make sure they match as you typed in AppAsset.php
0

#3 User is offline   callmesid 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 51
  • Joined: 26-November 16

Posted 07 March 2018 - 03:41 AM

View Postalrazi, on 06 March 2018 - 01:10 AM, said:

hard to point to what is wrong, but you could double check your file names make sure they match as you typed in AppAsset.php


Thanks Alrazi. From your guidance, I understood that, this is not something regular/syntax problem. So I checked all the settings and folder locations.

I found the issue and after required modification its working.

Regards,

Sid.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users