Use basic authentication with jQuery and Ajax

前端 未结 10 1078
野的像风
野的像风 2020-11-21 06:11

I am trying to create a basic authentication through the browser, but I can\'t really get there.

If this script won\'t be here the browser authentication will take o

10条回答
  •  面向向阳花
    2020-11-21 07:00

    Use the jQuery ajaxSetup function, that can set up default values for all ajax requests.

    $.ajaxSetup({
      headers: {
        'Authorization': "Basic XXXXX"
      }
    });
    

提交回复
热议问题