I am trying to access data stored in a JSON file (in the same folder as the gadget) using jquery. The following example works fine in both firefox and internet explorer (shows "success"), but as a gadget it doesn't work (shows "fail").
$('#gadgetContent').html("fail");
$.getJSON("test.json", function(data) {
$('#gadgetContent').html("success");
});
Any ideas as to what I'm doing wrong? Thanks.
UPDATE:
$.ajax({
url: "test.json",
dataType: 'json',
error: jsonError,
success: jsonSuccess
});
function jsonError(jqXHR, textStatus, errorThrown) {
// As a gadget this function is called
// jqXHR.readyState is 4
// jqXHR.status is 0
// jqXHR.responseText is undefined
}
function jsonSuccess(data) {
// Browsers reach here
}