I currently have a JSON file hosted on a CDN for my mobile app, which needs to prioritize minimal memory usage and load time efficiency. Currently, the JSON file is accessed via a RESTful GET API from the server. However, due to its size (37k), it significantly impacts the page load time (1.3 seconds). In order to improve this, I am exploring hosting these JSON files on a CDN and dynamically loading them based on user input.
Although I initially attempted to use jQuery $.getJSON, I encountered issues with cross-domain requests. Are there any elegant and reliable methods to access this JSON data in my JavaScript?
I envision something along the lines of:
url="http://cdn1.xxxx.xxx/?city="+$('#city').val()+".json";
$.getJSON( url, request, function( data, status, xhr )){});
The goal is to utilize this JSON as a source for a jQuery autocomplete text box. Any suggestions for alternative solutions to optimize load times would be greatly appreciated!