Results 1 to 3 of 3

Thread: pre processing ajax request extjs 6.7

  1. #1

    Default pre processing ajax request extjs 6.7

    hi

    I have to write a preprocessing syncro function before an Ajax request .

    this syncro function have to be called all times (beacuse is a method for token verification)

    in the documentation I have founded
    onBefore ( eventName, fn, [scope], [options] )
    How can use this parameter?

    Code:
    Ext.Ajax.request({
    
                url: myUrl, 
                method: 'GET',
                onBefore:'mynewFunction',
                success: function(response) {
                }
                   failure: function(response) {
    
                }


    the onBefore have to return value, how it works?
    is it better to override the extj ajax request or implemenet in every ajax call in controller?

















  2. #2
    Sencha User
    Join Date
    Aug 2017
    Posts
    18
    Answers
    3

    Default

    Hi,

    the beforerequest event is fired from the Ext.Ajax singelton.

    Code:
    Ext.Ajax.on('beforerequest', ()=> console.log('beforerequest'))
    You could also make a static function on your app that calls a beforerequest function and the executes a Ext.Ajax.request.

  3. #3

    Default

    thank you
    it works

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •