1. #1
    Sencha Premium Member
    Join Date
    Feb 2012
    Posts
    108
    Answers
    4
    Vote Rating
    1
    paulh1971 is on a distinguished road

      0  

    Default Unanswered: Including double quotes and some text bold and in color in my returned jsonp data

    Unanswered: Including double quotes and some text bold and in color in my returned jsonp data


    Hello,

    If I have double quotes and any text bold and in color returned from my jsonp data, I get Uncaught SyntaxError: Unexpected identifier I have found that this is an issue with special characters. How do you go about allowing what I am trying to do? I see double quotes in the data returned for the Watch List app, so I at least should be able to do that.

    Thanks,
    Paul

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,212
    Answers
    3517
    Vote Rating
    858
    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


    valid json (the bit inside the callback function of jsonp) needs to have the property and value surrounded in double quotes. If you are going to have double quotes within the value then you need to escape it or replace with ascii
    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 Premium Member
    Join Date
    Feb 2012
    Posts
    108
    Answers
    4
    Vote Rating
    1
    paulh1971 is on a distinguished road

      0  

    Default


    Thanks Mitchell,

    What about <span></span> or other tags? Is there not a way to do this. I would want to do this to make certain words bold and in a different color.

    Thanks,
    Paul

  4. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,212
    Answers
    3517
    Vote Rating
    858
    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


    Code:
    Ext.data.JsonP.request({
        url     : 'data/php.php',
        success : function(data) {
            console.log(data);
        }
    });
    response:

    Code:
    Ext.data.JsonP.callback1({
        "data": "<span class='test'>Test</span>"
    });
    That worked. Also tried this response:

    Code:
    Ext.data.JsonP.callback1({
        "data": "<span class=\"test\">Test</span>"
    });
    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.

  5. #5
    Sencha Premium Member
    Join Date
    Feb 2012
    Posts
    108
    Answers
    4
    Vote Rating
    1
    paulh1971 is on a distinguished road

      0  

    Default


    I have played around with this more, and for me any <spans>, <divs>, or any other tags, are ignored. So I cannot find a way to have any words bold or color. Is there a possible solution to this? Thanks!