How to send parameter to language url
How to send parameter to language url
inajaf
Posts: 13Questions: 8Answers: 0
Guys, how to send parameter to** language: { url: ** . url is not visible in language
var url = 'Not set';
var emp = $('#countable')
.on('init.dt', function () {
let language = document.documentElement.lang;
if (language === 'az') {
url = '/plugins/datatables/i18n/az_AZ.json'
} else if (language === 'ru') {
url = '/plugins/datatables/i18n/ru_RU.json'
}
})
.DataTable({
language: {
url: url,
paginate: {
next: '»',
previous: '«'
},
},
This question has an accepted answers - jump to answer
Answers
The
init
event fires after Datatables initialization not before. Move lines 6-12 outside theinit
function and execute those statements before initializing Datatables. Place them on line 2 for example.Kevin