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

      0  

    Default Answered: Can't parse a return string from JsonP!

    Answered: Can't parse a return string from JsonP!


    Hi guy,
    I have made a request of JsonP, but the return string can't parse. I don't know why?
    I'm using Sencha touch 2.0.1.1, webservice: attach file, browser: Safari: 5.1.7, OS: window 7.
    This is my code (copy from JsonP example, but the url is my web service):
    Code:
    Ext.Viewport.add({
        xtype: 'button',
        text: 'Make JsonP Request',
        centered: true,
        handler: function(button) {
            // Mask the viewport
            Ext.Viewport.mask();
    
    
            // Remove the button
            button.destroy();
    
    
            // Make the JsonP request
            Ext.data.JsonP.request({
                url: 'http://localhost:7794/GetEmployees.svc/json/hello',
                callbackKey: 'callback',
                success: function(result, request) {
                    // Unmask the viewport
                    Ext.Viewport.unmask();
                }
            });
        }
    });
    This is a error:
    json-fail.jpg

    json-fail-detail.jpg

    What's a trouble? The string is a json string. But why it can't read it?
    Please help me to solve it, thanks!
    Attached Files

  2. That's because your response is only JSON not JSONP. Sample JSONP is

    Code:
    Ext.data.JsonP.callback01({"success": true});

  3. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,801
    Answers
    3467
    Vote Rating
    834
    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


    That's because your response is only JSON not JSONP. Sample JSONP is

    Code:
    Ext.data.JsonP.callback01({"success": true});
    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.

  4. #3
    Sencha User
    Join Date
    May 2012
    Posts
    13
    Vote Rating
    0
    neobach is on a distinguished road

      0  

    Default jsonP string sample

    jsonP string sample


    Hi mitchellsimoens,
    May you share me a sample jsonP string? It's so good if there is a sample of web service that return a jsonP string.
    I have tried to return a string like:
    Code:
    {"helloResult":"Ext.data.JsonP.callback1({sucess:true})"}

    But it's still not work.
    Thanks so much

  5. #4
    Sencha User
    Join Date
    May 2012
    Posts
    13
    Vote Rating
    0
    neobach is on a distinguished road

      0  

    Default solved

    solved


    Hi, I have solved my trouble, we must config to WCF return the string in jsonP format.
    Thanks.

Thread Participants: 1

Tags for this Thread

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