separated out callback function from the ajax call, added example for login