Added beforeSend to ajax type