Mission SERVERLESS 101 - Task 2

Invoke the API Service using generated client JS SDK,

My index.html is as follows,

Get Instructions Add Item Get Items Purchase
</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>

Yes, I have put the appropriate keys into the above code. I am browsing index.html in Goggle Chrome browser. When I click the Get Instructions links it calls the function in controllor.js but when it tries to execute the code in js/services/CodelessShoppingCartService.js it tells me the web page is blocked.

I managed to finsih the task by using the backendless console, just wondering why I was getting the above error.

Many thanks for any help.
Gavin Baker.

Hello @Gavin_Baker

Could you please zip the project and send it to us, you can remove your APP_ID and API_KEY

Regards, Vlad

CodelessShoppingCartService.zip (3.5 KB)

Thank you for your email, please find the requested ZIP file attached, its probably a simple mistake on my part …

Many Thanks.

Gavin Baker. (endhousesoftware.byethost.com).#

unfortunately, I don’t see the index.html file in the archive

my index.html file is called CodelessShoppingCartService.html.Does it need to be called index.html?

Gavin Baker.

actually it should work with CodelessShoppingCartService.html.

However, there is some issue: “Cannot read property ‘getInstructions’ of undefined” in the ./js/controller.js file, which has been fixed and it will be released soon. As a workaround, you can add the following line as the first line in the ./js/controller.js file

window.CodelessShoppingCartService = Backendless.APIServices.CodelessShoppingCartService

I just checked it and everything works properly. If it doesn’t help you please show us the entire error you’ve got.

Regards, Vlad

1 Like

Hi, many thanks for your reply, adding this line to ./js/controller.js worked!

Gavin Baker.