Extract send xhr to a separate method