I have a url that is returns the xml data and it is uses the url with username and password.
$.ajax({
url: 'http://myserver.com:port/BC/rest/productslist/',
data: {
'username': 'username',
'password': 'password'
},
dataType: "jsonp", // for cross domain
contentType: "application/xml; charset=UTF-8",
type: 'GET',
crossDomain: true,
beforeSend : function(xhr) {
xhr.setRequestHeader("Authorization", "Basic" + window.btoa("username" + ":"+ "password"));
},
success: function(sucessResponse) {
alert('PUT completed' + sucessResponse);
} ,
error: function(failResponse){
alert("Error: Something went wrong" + JSON.stringify(failResponse));
}
});
Problem: When I am testing the code it is showing the error:
Uncaught SyntaxError: Unexpected token <' error.
Any suggestions? Thanks