Added Ajax friendly error handling (JSON view)