added saving during ajax call