Backendless Version (3.x / 5.x, Online / Managed / Pro )
Online
Client SDK (REST / Android / Objective-C / Swift / JS )
JS
Application ID
903A0E11-1F70-4761-FF6A-A1F6CB977100
Expected Behavior
Please describe the expected behavior of the issue, starting from the first action.
- Trying to execute last mission before getting Springboard plan
- Downloaded the index.html and controller.js
- When trying to invoke the getItems function, I got a cross-origin CORS error
Actual Behavior
Error message:
Access to XMLHttpRequest at ‘https://api.backendless.com///services/CodelessShoppingCartService/getInstructions’ from origin ‘https://treemotions.com’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.
The same happens from XAMPP. I already checked the app id domain control settings. Allowed domains are set tp “". Trying to set it to “treemotions.com” did also not work. It did even not save the change and stayed on "”.
Can you help here as I would really like to finalize the missions for the Springboard Plan before test month is over
Hello @Thomas_Fritsch ,
please replace body in your index.html file with this:
<body>
<a href="javascript:getInstructions()">Get Instructions</a>
<a href="javascript:addItem()">Add Item</a>
<a href="javascript:getItems()">Get Items</a>
<a href="javascript:purchase()">Purchase</a>
<div id="output">
</div>
<script src="http://api.backendless.com/sdk/js/latest/backendless.min.js"></script>
<script src="js/services/CodelessShoppingCartService.js"></script>
<script src="js/controller.js"></script>
<script type="text/javascript">
const appId = 'YOUR_APP_ID';
const apiKey = 'YOUR_API_KEY';
Backendless.initApp(appId, apiKey);
</script>
</body>
(do not forget to substitute your App ID and API Key)
Regards,
Stanislaw
Thanks, Stanislaw, but this is exactly how it looks like - including the correct App ID and API key…
<head lang="en">
<meta charset="UTF-8">
<title>CodelessShoppingCartService</title>
Get Instructions
Add Item
Get Items
Get Instructions
Or is the sequence important?
SOrry, I removed the html tags, but it is still interpreted
The three slashes in the path are weird:
https://api.backendless.com**///**services/CodelessShoppingCartService/getInstructions’
Sorry for the confusion. You were absolutely right. I downloaded the source code files from different sources and the one that was active did not contain the keys. Thanks, Stanislaw!
1 Like