Use jQuery’s beforeSend
callback to add an HTTP header with the authentication information:
beforeSend: function (xhr) {
xhr.setRequestHeader ("Authorization", "Basic " + btoa(username + ":" + password));
},
More Related Contents:
- How to send data to the server via Ajax?
- HTML: how refresh information in [closed]
- How to receive special character?
- How can I upload files asynchronously with jQuery?
- Download a file by jQuery.Ajax
- jQuery AJAX file upload PHP
- How do I POST urlencoded form data with $http without jQuery?
- ReactJS convert HTML string to JSX
- event.returnValue is deprecated. Please use the standard event.preventDefault() instead
- Jquery/Ajax call with timer
- Why is it a bad practice to return generated HTML instead of JSON? Or is it?
- Adding CSRFToken to Ajax request
- How to send a message to a particular client with socket.io
- What does “return false;” do?
- How to return an Ajax result using async/await? [duplicate]
- AJAX request to local file system not working in Chrome? [duplicate]
- Server polling with JavaScript
- pdf file upload ajax html
- Javascript regex returning true.. then false.. then true.. etc [duplicate]
- Is it any limit for POST data size in Ajax?
- Populating a select box using JQUERY, AJAX and PHP
- How to generate a thumbnail image after adding an image inside an input type=”file” in a form and submitting them both on the same form
- Chain ajax and execute it in sequence. Jquery Deferred
- “Permission denied” with Internet Explorer and jQuery
- How to show loading status in percentage for ajax response?
- Send form data using ajax
- jQuery ajax async: false causes a strange warning?
- How to catch net::ERR_CONNECTION_REFUSED
- Set Request Header jQuery Ajax
- ‘append’ called on an object that does not implement interface FormData