Q:

Exchange web service returns 401 unauthorized from AJAX

As mentioned I am getting an unauthorized 401 error for exchange web service.
Requirement : Get the mails from the mail exchange company server.
Code :
         var soapBodyXMLStr=(new XMLSerializer()).serializeToString(soapBody);
     soapBodyXMLStr=soapBodyXMLStr.replace(/[\r\n]/g," ");
         var hdrs = {

            'Authorization':'Basic'+ btoa('XXX\username:password')
         };

        var result = jQuery.sjax({
                type : "POST",
                url : 'https://domain/ews/exchange.asmx',
                 data:soapBodyXMLStr,
                 contentType:"text/xml; charset=\"utf-8\"",
                headers: hdrs,
               });

Now if I fire the URL in the desktop browser then its working fine but when I run on the mobile browser like Safari or chrome (IOS) then its throwing an error
Please let me know if you require more details .
Also please suggest me the solution.

A:

The issue is solved : just add "\" to user name like 'XXX\username' 

