I have following project structure
-root
-app.html
-scripts/
-jquery/
locales.js
-_locales/
-en/
-messages.json
in app.html I include the locales.js file in which I want to load the messages.json file like this
jQUery.get("../_locales/en/messages.json", function(data){
alert(data);
});
But this does not work. Any ideas?
Since you are using .get, what you need to provide is the URL to access _locals/en/messages.json either as an absolute URL or a URL relative to the page that the javascript is running from. To double check that your URL is working, try putting it into your location bar and making sure you get the file you expect. So as your URL stands now, it would be
<currentPageURL>../_locales/en/messages.json. If that works, you will want to start debugging what’s going on in your .get. First, though, make sure your URL is valid.