Assign elements on page with values from a JSON file

inveceree

New Member
I have a multilanguage web application and I want to store all the text in a JSON file and load in each text for each element on each page. For example:\[code\]$("h1.text1").append(data[language]['startpage'][0]['text1']);\[/code\]Tjis will depending on the language show a different text in h1.text1.At the moment I'm giving each element a unique class for example h1.text1 and in the JSON calling them by that class eg. text: "Title". Then I assign them with JQuery like the above example. Just wondering if there is a better way to do this? Because I'm going to have lots of lines of code to assign in each element in each page?
 
Back
Top