Why is my js not working as it should in edit.blade.php view. My views are structured as follows:
Filename: profile_main.blade.php
@extends('layouts.main')
@section('head')
@yield('style')
@stop
<!-- Available at the footer of page before body tag closes -->
@section('scripts')
<script src="{{ URL::asset('js/jquery-ui-1.11.4.custom/jquery-ui.js') }}"></script>
<script src="{{ URL::asset('js/search.js') }}"></script>
<script src="{{ URL::asset('js/application.js') }}"></script>
<script type="text/javascript">
$.ajaxSetup({
headers: { 'X-CSRF-Token' : $('meta[name=_token]').attr('content') }
});
</script>
@stop
Filename: training_main.blade.php
@extends('layouts.profile_main')
@section('style')
<link href="{{ URL::asset('css/application/index.css') }}" rel="stylesheet">
@stop
@section('body')
<div id="content-header">
<img alt="user_icon" src="{{ asset('images/general/admission_page_logo.jpg') }}" class="img-responsive"/>
<h1>@yield('page_heading')</h1>
<h3>@yield('page_desc')</h3>
</div>
<hr class="header_underline"/>
@yield('training_body')
@stop
Filename: edit.blade.php
@extends('trainings.training_main')
@section('page_heading')
Edit Training Details
@stop
@section('page_desc')
General
@stop
@section('training_body')
@stop
I have some jquery functions in application.js. I notice that these functions are not working in edit.blade.php. For example
Filename: application.js
$("document").ready(function() { alert('Great') });
It does not alert when the edit.blade.php view is loaded. But when I look at the page source, everything seems to be loaded fine like so:
<!-- Javascript -->
<script src="http://localhost:8000/js/jquery-1.11.3.js"></script>
<script src="http://localhost:8000/js/bootstrap.min.js"></script>
<script src="http://localhost:8000/js/main.js"></script>
<script src="http://localhost:8000/js/jquery-ui-1.11.4.custom/jquery-ui.js"></script>
<script src="http://localhost:8000/js/search.js"></script>
<script src="http://localhost:8000/js/application.js"></script>
<script type="text/javascript">
$.ajaxSetup({
headers: { 'X-CSRF-Token' : $('meta[name=_token]').attr('content') }
});
</script>
</body>
What could be the problem here? What are my missing?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire