jQuery AJAX Header Authorisation
问题 I'm trying to authorise an AJAX query based on this tutorial. It sets the request headers before send with the appropriate authorisation information by using the Crypto library. The problem I'm having is that headers don't seem to be set on request. Here's my code: beforeSend : function(xhr) { var bytes = Crypto.charenc.Binary.stringToBytes(username + ":" + password); var base64 = Crypto.util.bytesToBase64(bytes); xhr.setRequestHeader("Authorization", "Basic " + base64); }, 回答1: The issue was