Catch exception if data returned to ajax is not json

All tests pass.