Add error parameter for `getJSON`

Also check it everywhere `getJSON` is used.