Error:
jQuery.Deferred exception: $(…).DataTable is not a function TypeError: $(…).DataTable is not a function
$(document).ready(function () {
$("#searchEnquiryTable").DataTable({
autoWidth: true,
order: [[0, 'desc']],
scrollY: 250,
scrollX: true,
language: {
zeroRecords: "{{ __('No record found') }}.",
},
oLanguage: {
sSearch: "{{ __('Filter') }}:"
},
pageLength: 50,
});
searchEnquiryTbl = $("#searchEnquiryTable").DataTable();
})
layouts/admin.blade.php
<!-- datatable -->
<script src="{{ asset('vendor/DataTables/datatables.min.js') }}"></script>
<link href="{{ asset('vendor/DataTables/datatables.min.css') }}" rel="stylesheet">
<!-- datatable plugins -->
<script src="{{ asset('vendor/DataTables/plugins/dataRender/datetime.js') }}"></script>
<!-- datatable column recording and resize-->
<script src="{{ asset('vendor/DataTables/ColReorderWithResize.js') }}"></script>
I had the error appearing randomly upon refreshing but not every time refreshing occur for the laravel blade page but the functions are working properly and I am not sure whether the document.ready(function())
affecting the loading process. I would like to seek for possible solutions on fixing the error
I do not know why the error appearing randomly when refreshing sometimes
1