Hi Raghu.
The variable categoryModel1 doesn't exist in the success function context when it's called.
You have to get your model inside the success function.
//Get model for category var categoryModel1= sap.ui.getCore().getModel("categoryModel"); // service url var serviceUrl= oApplication.appData.serviceUrlRoot +"/rest/categories"; //call ajax method jQuery.ajax({ type : "GET", contentType : "application/json", url : serviceUrl, dataType : "json", //on success:set data to the category field success : function(data,textStatus, jqXHR) { console.log(data); var categoryModel1 = sap.ui.getCore().getModel(); // Get the model for this context categoryModel1.setData({ items :data }); }, error : function(jqXHR,textStatus,errorThrown) { raiseWebserviceException(jqXHR); } });
PS: you don't need to call the AJAX routine like you did. I changed it in the example, but if you want to use like you did before, no problem it'll work too.