hidayat3676's avatar

ajax $ not defined


1.$(document).ready(function () {
  $('.home').click(function () {
     $.get('/post',function () {

     });
  });
});

this  code give me error that $ is not  defined at line 1 why
0 likes
5 replies
Snapey's avatar

jquery is loaded at the bottom of the default template in app.js

Your jquery code needs to come AFTER inclusion of that file.

If you have not used the default app.js then you need to include jquery yourself.

ekhlas's avatar

because you are not calling jquery Like

<script src="{{ asset('/js/jquery-1.9.1.min.js') }}" type="text/javascript"></script>

in your heder

hidayat3676's avatar
<script type="text/javascript" src="{{asset('js/jquery.min.js')}}"></script>
i am including this but still not working
ekhlas's avatar

where you include it at the top? or bottom?

$(document).ready(function () must be after your included jquery

Please or to participate in this conversation.