Multiple JQuery .getJSON callbacks do not fire
jquery, json
Solution
Try :
var myVar2 = $.getJSON('myurl2').success(function(){
console.log("debug2 - success");
}).error(function(){
console.log("debug2 - error");
});
You will probably see the error message and not success. I would guess that 'myurl2' does not exist though it could be that it does exist but the script makes an HTTP response with an error heading. I think a JSON decode failure will also fire the error callback.
Problem
I am attempting to run the following code snippet: ``` var myVar1 = $.getJSON('myurl', function(json) { console.log("debug1", json); }); var myVar2 = $.getJSON('myurl2', function(json2) { console.log("debug2", json2); }); ``` And I never see the "debug2" entry appear in my console log. When I check the status of `myVar2` after the requests have completed, I see it populated with the correct data. When I append a `.complete()` statement at the end of the of the second `.getJSON()` request, the `.complete()` function will fire correctly. Using jQuery 1.7.2 and lastest stable of google chrome. Why will the second callback function not fire?