Skip to Content
0
Sep 21, 2017 at 12:41 PM

CORS issue with UI5- XSJS application

470 Views Last edit Sep 22, 2017 at 03:46 AM 3 rev

Hi All,

I am trying to make an application which can send data from UI5 application to HANA Xs service with complete URL.

With my use case , i can't specify destination.

Even after enabling cors settings i cant bypass the cors issue in chrome or any other web browser.

MY code is :

	var url = "https://XXXXXXXXXXXX.hana.ondemand.com/TESTUSER/recieveData.xsjs";
	var that = this;
	//myEventList = some json data
	var username = "userName";
	var password = "password";
	if (myEventList.length > 0) {
		$.ajax({
			type: "POST",
			url: url,
			dataType: 'json',
			async: false,
			beforeSend: function(xhr) {
				xhr.setRequestHeader("Authorization", "Basic " + btoa(username + ":" + password));
			},
			data: JSON.stringify(myEventList),
			success: function(result) {
				myEventList = [];
			},
			error: function(response) {
				console.log(response);
			}
		});