- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Add Authentication details in the AJAX request in SAPUI5
Basically you need to exploit the beforeSend function of JQuery AJAX to sort out your requirement.
Here is a basic code snippet −
function AddToHeader(xhr) { var pwd = // get the password; xhr.setRequestHeader("Authorization", "Basic " + btoa(user + ":" + pwd)); } $.ajax({ type: "GET", url: <method url >, dataType: "JSON", beforeSend: function(xhr) { AddToHeader (xhr); } }).done(function(data) { /* do success logic */ }
You can add further details to the header as explained in the AddToHeader method.
- Related Articles
- Explain the different ready states of a request in AJAX
- How to set cookie value with AJAX request in JavaScript?
- Request Timeout while using Odata call to a gateway in SAPUI5 application
- How to pass a CSRF token with an Ajax request in Laravel?
- In SAPUI5, how two add two icons in StandardListItem
- In SAP system, how can I find details of Change Request with modification?
- How to disable some jQuery global Ajax event handlers for a request?
- How to register a handler to be called when the Ajax request begins using jQuery?
- How to add groups in Django using authentication system?
- How to add authentication to Django Website?
- How to attach a function to be executed before an Ajax request is sent using jQuery?
- What is the difference between Ajax and jQuery-Ajax methods in jQuery?
- Using ControlAggregation in SAPUI5
- Explain JSON in AJAX?
- Passing to method geticon in SAPUI5

Advertisements