How to use beforeSend on app request


#1

How to use beforeSend on every app.request?


#2

Hi @arulraj

Try like this.

app.request({
  url: wsUrl,
  dataType: 'json',
  data: data,
  method: 'POST',
  headers: header,
  contentType: "application/json; charset=utf-8",
  timeout:30000,
  async:isAsync,
  beforeSend:function() {
      /This method will be called before webservice call initiate
  },success: function(data, status, xhr) {
    //Post request completed
  },
  error: function(xhr, status) {
    //Error occured;
  }
});

Which method will trigger before app.request.post?
#3
app.request.setup({
  beforeSend: function () {
    //do something before every request sent
  }
});