Loading 2 or mode jSon files problem in Jquery?
i am trying to load some data using json and jquery the problem occurs when i call data from 2 files like this:
$.getJSON('json/profile.json', function(data) {
$('#online').html(data.todo );
});
$.getJSON('json/character.json', function(data) {
$('#offline').html(data.fname + " " + data.lname );
});
if i use only one file it works, but with both doesnt. Wired.
any ideas?
thanks
edit: i have them like thi开发者_开发技巧s: i have an index.php and file1.php and file2.php .
each file1 and file2 are included in the index.php and each file1.php and file2.php call a json file.
I bet you execute them in that sequence every time. The first one works because the JSON is well-formed, the second one fails because the JSON is malformed. $.getJSON
will fail silently if it gets bad JSON from the server.
精彩评论