如何从odata模型中获取数据?我有“失败”消息提醒,有人可以帮助我吗?
var sservices_url ="http://services.odata.org/Northwind/Northwind.svc/";
var omodel = new sap.ui.model.odata.ODataModel(sservices_url,true);
omodel.read('/Products(1)', null, null, true, function(oData, oResponse){
alert("Read successful: " + JSON.stringify(oData));
},function(){
alert("Read failed");});
我假设您正在使用SAP Web IDE。
SAP社区中有一些关于在SAP Web IDE中使用Northwind的文章。在SAP Cloud Platform(SCP)中为Northwind创建目标。
我强烈建议,不要使用未知代理(例如cors-anywhere.herokuapp.com
),而是在配置中定义目标,如以下文档主题中所述:Create a Northwind Destination