jQuery AJAX Header Authorisation

后端 未结 2 2079
北海茫月
北海茫月 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:19

    The issue was not setting the dataType to JSONP. As this was not done the browser interpreted the call as a standard AJAX request which meant it was being blocked under same-origin-policy.

    Working code for reference (credit goes to @pdeschen for suggesting Crpyto):

     
    

提交回复
热议问题