BillyBob BillyBob - 1 year ago 70
HTML Question

Access JSON files in a JavaScript and HTML application

I want to implement i18n in my application, which is written in HTML and JavaScript, with PHP as the backend. I have a JSON file, with all the keys and translations. Since I've read that JSON files cannot be read from local storage, where would I store these JSON files, on XAMPP, so I can access them in my app? Also, can I directly access them using JavaScript, or would I need to use PHP?

Thank you

Answer Source

this is using jQuery

        url: url +"//jsonfile.txt",
        dataType: 'text',
        success: function (data, status) {
            var jsonObject = JSON.parse(data);
            jsondata = jsonObject;
        error: function () {

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download