I use selectivity.js in my spring application , which is a select library with a nice "tag viewer". Right now I have a js file where I set up selectivity data:
$(document).ready(
function() {
$('#single-input-with-labels').selectivity(
{
multiple : true,
items :
[
{
text : 'City',
children : [{
id : 1,
text : 'cityName1'
}, {
id : 2,
text : 'cityName2'
}, {
id : 3,
text : 'cityName3'
}]
}, {
text : 'Type',
children : [{
id : 4,
text : '2.1.typeName1'
}, {
id : 5,
text : '2.2.typeName2'
}, {
id : 6,
text : '2.3.typeName3'
}]
}
],
placeholder : 'ie. City, Type, ...',
searchInputPlaceholder : 'Type to search'
});
}
);
Run codeHide resultBut I need to have this configuration:
{
multiple : true,
items :
[
{
text : 'City',
children : [{
id : 1,
text : 'cityName1'
}, {
id : 2,
text : 'cityName2'
}, {
id : 3,
text : 'cityName3'
}]
}, {
text : 'Type',
children : [{
id : 4,
text : '2.1.typeName1'
}, {
id : 5,
text : '2.2.typeName2'
}, {
id : 6,
text : '2.3.typeName3'
}]
}
],
placeholder : 'ie. City, Type, ...',
searchInputPlaceholder : 'Type to search'
}
Run codeHide resultin some file, for example: "myData.txt". I will create this txt file programmatically from the java site after analyzing some data. In the next step, I need to read this structure from the js function:
$(document).ready(
function() {
$('#single-input-with-labels').selectivity(
Run codeHide resultDo you know how to read this data structure from another text file to make it work?