title: Fetching JSON data using Sencha Touch
body: <p>How do I capture JSON data generated using PHP in Sencha Touch? Does anyone know a good tutorial on that?</p>
  
  <p>I'm trying to get the JSON data using the codes below</p>
  
  <pre><code>Ext.util.JSONP.request({
      url: 'proc/getEvents.php',
      callbackKey: 'callback',
      callback: function(data) {
          var lists = data.results;
          timeline.update(lists); // Update events lists
      }
  });
  </code></pre>
  
  <p>My JSON data is like (generated by getEvents.php):</p>
  
  <pre><code>{
     "sample":[
        {
           "id":"1",
           "name":"131\/E Address",
           "desc":"This is where I live!!",
           "lat":"0",
           "lon":"0",
           "starttime":"0",
           "endtime":"0",
           "flag":"0"
        },
        {
           "id":"2",
           "name":"INOX",
           "desc":"Central Mall",
           "lat":"0",
           "lon":"0",
           "starttime":"0",
           "endtime":"0",
           "flag":"0"
        }
     ]
  }
  </code></pre>
  
  <p>Now I want to display it in a template.</p>
  
  <pre><code>tpl: [
          '&lt;tpl for="."&gt;',
              '&lt;div class="details"&gt;',
                  '&lt;h2&gt;{name}&lt;/h2&gt;',
                  '&lt;p&gt;{desc}&lt;/p&gt;',
              '&lt;/div&gt;',
          '&lt;/tpl&gt;'
       ]
  </code></pre>
  
  <p>Can anyone help me figure out where the problem is?? My javascript console says (with getEvents.php)</p>
  
  <pre><code>Resource interpreted as Script but transferred with MIME type text/html.
  getEvents.php:1Uncaught SyntaxError: Unexpected token :
  </code></pre>