Hybrid View

  1. #1
    Sencha User
    Join Date
    May 2012
    Posts
    23
    Vote Rating
    0
    manvinder is on a distinguished road

      0  

    Default Problem in using JsonP request

    Problem in using JsonP request


    hi all,

    I am using following code on tap of a button in my app to add some item to my cart on the server.

    Ext.data.JsonP.request({
    url : localStorage.getItem('serverPath') + 'addToCart.php',
    //callbackKey: 'callback',
    params: {
    strEmail: sessionStorage.getItem('loginUserId'),
    customerId: sessionStorage.getItem('customerId'),
    productSKU: sizeRecord[0].get('sizeSkuModifier') + productInfoStore.get('sku') + finishRecord.get('text'),//"MC-3X51073460",=> sizeSkuModifiers + SKU + ColorSKUModifiers
    productPrice: finishRecord.get('price'),
    productID: productInfoStore.get('productId'),
    variantID: finishRecord.get('variantId'),
    quantity: '1',
    chosenColor: color,
    chosenColorSKUModifier: colorSKU,
    chosenSize: sizeRecord[0].get('size'),
    chosenSizeSKUModifier: sizeRecord[0].get('sizeSkuModifier')
    },
    success: function(response,opts) {

    sessionStorage.setItem('customerId', response.addItemsToCartResult);//store customerId for future use
    localStorage.setItem('customerId', response.addItemsToCartResult);

    if(cartStoreOffline.getCount() != 0) {
    if(!me.offlineCartItemsPanel){
    me.offlineCartItemsPanel = Ext.create('Wilsonart.view.tablet.OfflineCartItems');
    }
    me.offlineCartItemsPanel.show();
    }
    else {
    me.onSuccessAddToCart();
    }

    Ext.getCmp('addToCart').enable();
    },
    failure: function(response,opts) {
    if (response.timedout) {
    Ext.Msg.alert(captions.get('timeout'), captions.get('serverTimeout'));
    }
    else if (response.aborted) {
    Ext.Msg.alert(captions.get('aborted'), captions.get('requestAborted'));
    } else {
    Ext.Msg.alert(captions.get('bad'), captions.get('invalidRequest'));
    }
    Ext.getCmp('addToCart').enable();
    }
    });

    It works fine except that it makes multiple entries on the server even I have tapped the button only once. To overcome the situation I disabled the button once it is tapped and I am enabling it only after receiving response from server. but it also doesn't works.

    Please help me.

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,756
    Vote Rating
    828
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    If it's only being executed only once then there will only be one request. Is it being executed more than once?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    May 2012
    Posts
    23
    Vote Rating
    0
    manvinder is on a distinguished road

      0  

    Default


    Thanks Mitchell. I found the problem. It was sending multiple request when I was testing the app on browser(I don't now why?). but it was running fine on iPad.

Thread Participants: 1

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi