Skip to Content

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

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("https://iot694p1940669937trial.hanatrial.ondemand.com/IoT/?dream.out.format=jsonp&dream.out.pre");

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

Anyone please help me out.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • 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 https://iot694p1940669937trial.hanatrial.ondemand.com/IoT/?dream.out.format=jsonp&dream.out.pre 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

    Add comment
    10|10000 characters needed characters exceeded