Skip to Content
0
Former Member
Aug 14, 2015 at 02:16 PM

Unable to perform create/delete operations on JSON Data

33 Views

Hi

I am trying to insert records/delete records in json model with the below code

if(this.mode == 'create'){

var url = "http://services.odata.org/V3/Northwind/Northwind.svc/Products?$format=json";

var method = "POST";

requestObj.requestUri = url;

requestObj.method = method;

requestObj.data = newData;

}else if(this.mode == 'edit') {

var id = $("#ProductID").val();

var url = "http://services.odata.org/V3/Northwind/Northwind.svc/Products?$format=json";

var method = "PUT";

requestObj.requestUri = url;

requestObj.method = method;

requestObj.data = newData;

}else if(this.mode == 'delete') {

var id = this.removeId;

var url = "http://services.odata.org/V3/Northwind/Northwind.svc/Products?$format=json";

var method = "DELETE";

requestObj.requestUri = url;

requestObj.method = method;

}

oData.request(requestObj, function() {

sap.ui.getCore().getModel('northwind').refresh();

$("#formId").slideUp();

}); }});

I am getting "oData not defined error" in my browser while performing any operations on the table(create,delete,edit).

Thanks

Prasad