how to load/use hi.json file which is present in my local machine
how to load/use hi.json file which is present in my local machine
Hi,
I have a working example of Datatabes, i want to use the I18N feature of this. I downloaded the hi.json file and i'm trying to use it like this, but it is not changing the language.
$('#example').DataTable( {
language: {
url: 'hi.json',
},
info: false,
data: data,
columnDefs: [
{
title: 'custom Column',
targets: 2
}
],
columns: [
{ data: 'name' },
{ data: 'position' },
{ data: 'office' },
{ data: 'salary' }
]
} );
Answers
Check the browser's console and the browser's network inspector tool to make sure its loading the file. You won't be able to load it directly from the file system because ajax doesn't allow that for security reasons. You will need a webserver to server the file or use a CDN resource.
Kevin
The other option, if you aren't using a web server, is to place the JSON in your Javascript script directly.
Kevin