Skip to Content
0
Mar 26, 2015 at 11:03 AM

How to make ajax GET call to fetch data and set filters,using OData servicesll me in sapui5?

1739 Views

Hello UI5 experts,

Please tell me how to make ajax call for GET in order to fetch data using OData services. I have to send user's input as filter to the backend, on which basis data for three textfields is to be fetched.

I am trying following code but getting an error saying "403 forbidden error" and "filter is not defined" :

jQuery.ajax({

url: "http://172.25.10.102:8000/sap/opu/odata/SAP/***********_SRV ",

method: 'GET',

data: {username: "COPS_USER", password: "init123"},

//async: false,

dataType: 'json',

success: function(data) {

alert('Successful in json call ');

//oJSON = JSON.parse(response.body);

},

error: function(err) {alert('Error in json call ', err);}

});

Earlier i was trying to set filters as follows:

url: "http://172.25.10.102:8000/sap/opu/odata/SAP/***********_SRV/GET_DETAILS?$filter=code eq 'value1' ",

but it gave me error "400 bad request"


Kindly help me out with this.


Best Regards,

Chetna