Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 2812

Re: Load oData via javascript

$
0
0

Hi ,

You need to biond the callback function on success/error.

 

oModel.read('/dataSet', null, null, true, function(oData, oResponse){

  alert("Read successful: " + JSON.stringify(oData));

  },function(){

alert("Read failed");})


In the success function you have to handle your events.

 

Have a look at JsDoc Report - SAP UI development Toolkit for HTML5 - API Reference - sap.ui.model.odata.ODataModel

 

Second option is using ajax call (Less Prefered)

 

$.ajax({

  
'url':'/sap/opu/odata/sap/ZPLAN_CPRAZO_SRV/ZFIORI_ZPLAN_CPRAZO_003Set(DataIni=datetime'2014-09-15T00:00:00',DataFim=datetime'2014-09-17T00:00:00',Obra='1500')", false',
  
'type':'GET',
  
'success':function(data){  
  alert
('Data: '+data);
  
},
  
'error':function(request,error)
  
{
  alert
("Request: "+JSON.stringify(request));
  
}
  
});





Viewing all articles
Browse latest Browse all 2812

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>