1. #1
    Sencha User
    Join Date
    Mar 2012
    Posts
    4
    Vote Rating
    0
    ericgranger is on a distinguished road

      0  

    Default Unanswered: "Ext.util.JSONP.request" fire only once

    Unanswered: "Ext.util.JSONP.request" fire only once


    Hi,

    I make a JSONP request using Sencha touch, but it fires only onle. If I try to make a second call nothing appends. The name of the callback function can not be changed for information

    Here is my code :

    YAHOO.Finance.SymbolSuggest.ssCallback = function(data) {
    console.log(data);
    };
    urly='http://d.yimg.com/autoc.finance.yahoo.com/autoc';
    req = function() {
    Ext.util.JSONP.request({
    url: urly,
    callbackKey: 'callback1',
    params: {
    query: 'yahoo',
    callback: 'YAHOO.Finance.SymbolSuggest.ssCallback'
    },
    callback1: function(result) {
    console.log('ok');
    }
    });
    }

    Thanks for help

  2. #2
    Sencha Premium Member
    Join Date
    Jul 2010
    Location
    Boston, MA
    Posts
    81
    Vote Rating
    3
    Answers
    2
    jodo3k is on a distinguished road

      0  

    Default Same issue here. Only fires the first time.

    Same issue here. Only fires the first time.


    Did you every figure this out? I have the same issue.

    My code works perfectly the first time. But the JSONP request won't call again unless I reload the whole page/app in the browser. (in my case I'm inserting ads in various places in a list.)

    I've inserted console.logs all over the place to verify things like function called, url is correct, etc.
    Everything is happening correctly EXCEPT the actual JSONP call doesn't happen after the first time.

    I can see from the Network tab in the Inspector that the call isn't happening. Ideas/Suggestions are greatly appreciated. Thanks.

    Code:
    tpl: new Ext.XTemplate(MH.classes.Tpls.guysGrid, {
        compiled: true,
        adLink: function(index) {
            console.log('adLink called: ' + index);
            var randomNumber = Math.floor((Math.random() * 30) + 1);
            var adUrl = mhUrls.getAds + "fc.php?script=obMobile:JSON&zoneid=142&callback=callback&rand=" + randomNumber;
            console.log("adUrl: " + adUrl);
            Ext.util.JSONP.request({ 
                url: adUrl,
                scope: this
            });
            console.log('adLink complete: ' + index);
        }
    }),
    
    
    ...
    
    
    function callback(data) {
        console.log("returned: " + data.html);
        Ext.DomHelper.insertHtml("beforeend", document.getElementById("adwrapper9"), data.html);
    }

  3. #3
    Sencha User
    Join Date
    Mar 2012
    Posts
    4
    Vote Rating
    0
    ericgranger is on a distinguished road

      0  

    Default


    The solution is : Ext.util.JSONP.current = undefined;

    But i ended using ajax

  4. #4
    Sencha User
    Join Date
    Dec 2011
    Posts
    16
    Vote Rating
    0
    PrashanthShetty is on a distinguished road

      0  

    Default Try This

    Try This


    Ext.data.JsonP.request({
    url: 'http://myserver/testdetails.php',
    callbackKey: 'callback',
    params: {
    q: "bored",
    rpp: 30,
    uniqueify: Math.random()
    },
    callback: function (data) {
    alert('Hiiiiiiiiii')


    }
    });
    Thanks,
    Prashanth

Thread Participants: 2

Tags for this Thread