View Full Version : Data Store and CORS problem

9 Dec 2014, 12:08 AM
Hi all

Very new to extJS and am having trouble with a datastore. I'm using a service (written in .net using c#) to extract data from a database. When I consume the service in testing, I get the results I expect to see. When attempting to get the data from my datastore however, I get a "connection refused" error and in Mozilla the error is more descriptive and points out that the CORS principle is being violated so the browser refuses the connection even though it's on my local host within the same project and port.

Do any of you know of a solution to this problem please or have an example of how I can extract data from a mysql database using c#? Perhaps not use a service?

Thank you

9 Dec 2014, 12:47 AM
Hi Ripple,

Look in API to configure a proxy with JsonP (http://docs.sencha.com/extjs/4.2.3/#!/api/Ext.data.proxy.JsonP)type.
The JsonP proxy is useful when you need to load data from a domain other than the one your application is running on.

var store =Ext.create (http://docs.sencha.com/extjs/4.2.3/#!/api/Ext-method-create)('Ext.data.Store (http://docs.sencha.com/extjs/4.2.3/#!/api/Ext.data.Store)',{
url :'http://domainB.com/users'

9 Dec 2014, 2:39 AM
Thanks Aaugen. That's put me on the right track.