Moved the view reference object outside of the AJAX reponse function