Replaced $.getJSON with $.ajax, so we can check errors