cancel
Showing results for 
Search instead for 
Did you mean: 

How to call a function from one function in sapui5

0 Kudos
4,570

Hi experts ,

I developed here one oData Get call  that is working fine. But form the success function i just need to call one more function there .

So how to call the other function from the success function.

Plz correct me if i may did wrong anywhere. And send me your guidelines.

I attached my coding here .

press :function () {

  var surl = "service url here ";

     OData.request

                      ({ 

        requestUri:surl, 

                 method: "GET", 

                 headers:

                     {      

       "X-Requested-With": "XMLHttpRequest",

       "Content-Type": "application/atom+xml",

       "DataServiceVersion": "2.0",         

      "X-CSRF-Token":"Fetch"                               

                }       

              },

             function(data, response) { // onSuccess function called when everything is ok

  

       this.applySearch(); // if i call  the function like this i am getting error like this is not a function like that

   

   

    }

},

applySearh : function  () {

}

Thanks and  Regards ,

Damian .A

View Entire Topic
jamie_cawley
Product and Topic Expert
Product and Topic Expert
0 Kudos

You could set a var to the context of press

var self =  this;

and then in you success function

self.applySearch()

There's also other ways such as jQuery.proxy to do the same.

Regards,

Jamie

SAP - Technology RIG