Add exception handling for AJAX responses which are not valid JSON