Updated javascript for new HTTP reponse status