added the beforesend option, useful for capturing the raw xhr object prior to request submission.