Skip to content

Instantly share code, notes, and snippets.

@kennym
Created March 23, 2012 02:05
Show Gist options
  • Save kennym/2166185 to your computer and use it in GitHub Desktop.
Save kennym/2166185 to your computer and use it in GitHub Desktop.
Sencha Touch JSON-P and Ruby on Rails
class SampleController < ApplicationController
respond_to :json
def index
@nodes = Node.all
render :json => @nodes.to_json, :callback => params[:callback]
end
end
Ext.define('App.store.SampleStore', {
extend: 'Ext.data.Store',
requires: [
"Ext.data.proxy.JsonP"
],
config: {
model: 'App.model.Sample',
autoLoad: true,
proxy: {
type: 'jsonp',
url: 'http://www.example.com/nodes.json',
reader: {
type: "json",
rootProperty: ""
}
},
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment