Quantcast
Channel: C1 CMS Foundation - Open Source on .NET
Viewing all articles
Browse latest Browse all 2540

New Post: Cross domain ajax calls with basic autho

$
0
0
Am trying to make an ajax call to another domain from /frontEnd/Scripts/script.js in Composite C1 but each time I add the username and password, the call omits it and fails. Is this a setting in Composite that is preventing me from doing cross domain call that require authentication?

Example:
$.ajax(
                {
                //beforeSend: function (xhr) {
                //  xhr.setRequestHeader ("Authorization", "Basic " + btoa('user:password01'));
                //},
                    url : 'https://subdomain.domain.com/bas/customers/3218348',
                username: user,
                password: password01,
                data : {},
                success:function(data, textStatus, jqXHR) 
                {
                    //data: return data from server
                    console.log('got back data', data);
                },
                error: function(jqXHR, textStatus, errorThrown) 
                {
                    //if fails      
                }
            }); // end of ajax

Viewing all articles
Browse latest Browse all 2540

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>