jQuery AJAX Header Authorisation

后端 未结 2 2063
北海茫月
北海茫月 2020-12-31 22:28

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 lib

2条回答
  •  伪装坚强ぢ
    2020-12-31 23:11

    This finally seems to work for me. There could be collisions on an individual call basis. Sets this method as a default for future connection options.

    //Function( jqXHR jqXHR )
    $.ajaxSetup( {beforeSend: function(jqXHR) {
        jqXHR.setRequestHeader( "My-Header", "My-Value" );
    } } );
    

提交回复
热议问题