Adding JS event handling for ajax