Javascript does not load function

0

I have a javascript file ' cep '. where it has a method called displays (); but when I run this method in my current file that is on the page next to HTML, it does not work, why?

cep.js

$ (document).ready(function () {
     function exibe()
     {
          alert ('Hello');
     }
  });

index.html

HTML
.
.
.

@section ('page-script')
<script src = "{{asset ('js/cep.js')}}"> </ script>
   $ (document).ready(function () {                    
             exibe();    
   });

</ script>
@endsection
    
asked by anonymous 12.01.2018 / 22:13

1 answer

1

Because you have declared your role within another, not in the global scope. Here's how:

cep.js

function exibe()
{
     alert ('Hello');
}
    
12.01.2018 / 22:29