Oh, there is another way, but I haven't found where to set this. At the moment, it seems that the REST API server is setting the property Access-Control-Allow-Origin to * (wildcard). By doing this it prevents jQuery from using xhrFields: { withCredentials: true }. If you can find where this is being set, you can change it to the server where you have your jQuery script and then withCredentials should work.
Your code should then be:
Code: Select all
function testAjax() {
return $.ajax({
url: "http://localhost:port/api/v1/Cubes('GL')/Views('Default')/tm1.Execute",
method: 'POST',
data: { '$expand': 'cells' }
crossDomain: true,
xhrFields: { withCredentials: true }
});
}