moved setRequestHeader call after open call