1. #41
    Sencha User
    Join Date
    Oct 2007
    Posts
    447
    Vote Rating
    0
    mxu is on a distinguished road

      0  

    Arrow

    the codes I used for synchronous call is just set async: false, but it stopped working as it used to.
    at async: false for Ext.Ajax.request ({...}), asynchronous call is undertaken. how should
    I get synchronous call back ?

    thanks

    mxu

    //////////////////////////////////////////////////////////
    Ext.Ajax.request ({
    //Ext.lib.Ajax.request({
    url: url2use,
    params: {},
    method: 'GET',
    async: false,
    scope: this,
    success: function (result, request) {
    var jsonData = Ext.util.JSON.decode(result.responseText);
    ...
    },
    failure: function ( result, request) {
    Ext.ux.GaPMegBox.show('Ajax Request Error', 'Failed to get information on SNP<br/>and use default setting instead' , 5);
    },
    callback: function( result, request ){

    }
    });
    ////////////////////////////////////////////////////////////////

  2. #42
    Ext User
    Join Date
    Jan 2010
    Posts
    4
    Vote Rating
    0
    RakeshAdvani is on a distinguished road

      0  

    Default

    Hi

  3. #43
    Sencha - Services Team hendricd's Avatar
    Join Date
    Aug 2007
    Location
    Long Island, NY USA
    Posts
    5,965
    Vote Rating
    12
    hendricd will become famous soon enough hendricd will become famous soon enough

      0  

    Default

    Quote Originally Posted by mxu View Post
    the codes I used for synchronous call is just set async: false, but it stopped working as it used to.
    at async: false for Ext.Ajax.request ({...}), asynchronous call is undertaken. how should
    I get synchronous call back ?

    thanks

    mxu

    //////////////////////////////////////////////////////////
    Ext.Ajax.request ({
    //Ext.lib.Ajax.request({
    url: url2use,
    params: {},
    method: 'GET',
    async: false,
    scope: this,
    success: function (result, request) {
    var jsonData = Ext.util.JSON.decode(result.responseText);
    ...
    },
    failure: function ( result, request) {
    Ext.ux.GaPMegBox.show('Ajax Request Error', 'Failed to get information on SNP<br/>and use default setting instead' , 5);
    },
    callback: function( result, request ){

    }
    });
    ////////////////////////////////////////////////////////////////
    @mxu -- basex preserves the callback functionality, so include your handling in the success/failure callbacks as you normally would.

    The request is still made synchronously.
    "be dom-ready..."
    Doug Hendricks

    Maintaining ux: ManagedIFrame, MIF2 (FAQ, Wiki), ux.Media/Flash, AudioEvents, ux.Chart[Fusion,OFC,amChart], ext-basex.js/$JIT, Documentation Site.


    Got Sencha licensing questions? Find out more here.


  4. #44
    Ext JS Premium Member mcouillard's Avatar
    Join Date
    Jun 2008
    Location
    Bucks County, PA
    Posts
    108
    Vote Rating
    11
    mcouillard will become famous soon enough

      0  

    Default my solution

    Quote Originally Posted by MaxT View Post
    Just as a thought, how have people got round using a synchronous request when using a window unload or beforeunload event? Useful for saving state for a page, for example. With an asynchronous call the callback function gets destroyed before it can be executed. In effect, you never know if the async. call has been successful.

    Max
    I had the same challenge. It's ideal for my app to only save state to the server on page unload. So I use the 'onbeforeunload' window event and a standard XMLHTTP wrapper to make a synchronous POST to the server with the state. It works fine, but only Firefox shows a nice Ext mask loading message before the POST. IE prevents such actions during this event, I guess.

  5. #45
    Sencha User
    Join Date
    Aug 2012
    Location
    Kansas City - Metro
    Posts
    23
    Vote Rating
    1
    huskerguy is on a distinguished road

      0  

    Default It is possible to do a sync call with the Ajax object

    most Ajax objects have an async flag true or false. Most people don't know this and at times can solve brower issures.

  6. #46
    Sencha User
    Join Date
    Nov 2011
    Location
    SF Bay Area
    Posts
    3
    Vote Rating
    0
    srinivasan.mohan is on a distinguished road

      0  

    Default Test

    Test.