Skip to Content

How to remove Unexpected token : error while loading data to json model from cross origin url in ui5

Jun 28, 2017 at 05:58 AM


avatar image

I am trying to parse a cross origin url in load data method for a json model but it shows me unexpected token error : .

this is my code with url:-

var oModel = new sap.ui.model.json.JSONModel(); oModel.loadData("");

url is working fine but i am not able to load data to json.

Anyone please help me out.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Hunter Young
Feb 28 at 05:51 AM

Hi Ayush,

If you look in the "Network" tab of Chrome's DevTools when your model is instantiated, you should be able to see the request to and the subsequent response. My suspicion is that either the request is being blocked due to the lack of an Access-Control-Allow-Origin header, or that the necessary authentication parameters are not being passed in the XHR. Regardless, you should see some additional information in the response in DevTools that should point you in the right direction.

Best Regards,

Hunter Young

10 |10000 characters needed characters left characters exceeded