Hi All, Well because I am on my way to become ExtJs Fan so I will write few articles when I learn new stuff with ExtJS. We all know JSONP. If you don't know what JSONP is you can get started by reading this article on Wikipedia http://en.wikipedia.org/wiki/JSONP All major Javascript libraries support it. But this post is about how to JSONP in Extjs 4. JSONP is an essential proxy and should only be used when making requests to a domain which is different to you current domain. say for example your website runs under abc.com and you would like to get some data from def.com using javascript, default settings will not allow you to do that because of security reason. When you read above article that explains a lot. Sort of technical definition JSONP is script tag injection, passing the response from the server in to a user specified javascript function Let's find out how JSONP requests are made using ExtJS 4 library Well I am going to start with, You guessed it right "Twitter" Twitter offers a public API and support for JSON. With our example first we will include Ext JS in our page like shown below. You will need to change the path to ext files I assume you are familiar with MVC in ExtJs. MVC stands for Model, View, Controller Model is something that defines data and we are going to define one for my twitter account as below So basically I am creating a Data Model with three fields named: text - holds my tweet user_name: holds my full user name created_at: Time it was created. That's UTC time. Because twitter returns far more data, I set my fields to limit the number of fields I want and get rid of the junk. This also allows me to access these fields in a nicer manner. Then comes the important part i.e. defining a proxy. We are using JSONP proxy thus we will set proxy type to 'jsonp' and we will need URL from where we are going to get our data from. reader property is important so that I can set my root … [Read more...]





JC WordPress Coupon Revealer Plugin Pro License
Australian Street Names with City, State and Display Names only, Single Server License
Recent Comments