Moved afteredit call to ajax complete