1. #1
    Touch Premium Member
    Join Date
    May 2011
    Location
    Norfolk & DC
    Posts
    100
    Vote Rating
    5
    epiphanydigital is on a distinguished road

      0  

    Default "Uncaught SyntaxError: Unexpected token :" when using JSONP and scripttag

    "Uncaught SyntaxError: Unexpected token :" when using JSONP and scripttag


    Does anyone have any idea why this wouldn't work? I get the error when trying to load the json from my server.

    "Uncaught SyntaxError: Unexpected token :" when using JSONP and scripttag


    Code:
    Ext.regModel('MenuItem', {
      fields: [
        {name: 'id',      type: 'int'},
        {name: 'title',    type: 'string'}
        //{name: 'body',     type: 'string'}
      ]
    });
    
    MyDS.MenuStore = new Ext.data.Store({
      model: 'MenuItem',
      proxy: {
        //type: 'ajax',
        type: 'scripttag',
        url: 'http://1ldev251.iqsolutions.com/myds2-rpc/testing.json', // DOES NOT WORK, EXACTLY THE SAME CONTENT AS THE BELOW URL:
        //url: 'http://query.yahooapis.com/v1/public/yql?format=json&q=select%20*%20from%20flickr.photos.search%20where%20text%3D%22hello%22%20limit%2010', // WORKS!
        reader: new Ext.data.JsonReader({
          root: 'query.results.photo'
        })
      }
    });

  2. #2
    Touch Premium Member
    Join Date
    May 2011
    Location
    Norfolk & DC
    Posts
    100
    Vote Rating
    5
    epiphanydigital is on a distinguished road

      0  

    Default


    So the answer to this question is found here on another thread I was on, hopefully this helps someone else as well. Thanks bclinton for all your help!

    http://www.sencha.com/forum/showthre...-and-scripttag

  3. #3
    Sencha Premium Member
    Join Date
    May 2012
    Posts
    63
    Vote Rating
    1
    stevanicus is on a distinguished road

      0  

    Default


    thank you was missing this

    PHP Code:

    $callback 
    $_REQUEST['callback'];if($callback){    header('Content-Type: text/javascript, charset=UTF-8');    echo $callback '(' json_encode($response) . ');';}else{    header('Content-Type: application/x-json, charset=UTF-8');    echo json_encode($response);} 

Thread Participants: 1

Tags for this Thread