Monday, 12 August 2013

JQuery get() or getJSON only work for local files

JQuery get() or getJSON only work for local files

I'm tring to load a test.json file from my server. The index.html which
trys to load that file is on another server(infact its a local file).
$url = 'test.json';
$.getJSON($url, function(data) {
for (var i = 0, len = data.length; i < len; i++) {
//some code
}
});
works perfect. but when i set $url = 'http://simonappelt.de/test.json' it
doesn't do anything. I also tried the get() function to get files from my
server but they seam to load nothing.
Thanks Simon

No comments:

Post a Comment