View Full Version : Access Is Denied - proxy ajax

8 Jul 2013, 1:13 PM
I'm getting an 'Access is Denied' when trying to read from a json file with proxy type 'ajax'. I'm using IE6. If anyone has any insight, i'd appreciate it.

In my users.js store
Ext.define('AM.store.Users', {
extend: 'Ext.data.Store',
model: 'AM.model.User',
autoLoad: true,

proxy: {
type: 'ajax',
url: 'data/users.json',
reader: {
type: 'json',
root: users,
successProperty: 'success'

"success": true,
"users": [
"name": "James",
"email": "james@gmail.com
"name": "Bill",
"email": "Bill@gmail.com

9 Jul 2013, 5:18 AM
Which other browsers have you tried?

Are you serving the page up via a webserver (rather than directly off the filesystem)?

9 Jul 2013, 5:31 AM
Its from the file system. I've also tried it on Chrome and got an acces-contorl-allow-origin error... So for ajax, it needs to load up from a web server to work? My environment currently limits me to developing from the file system. Is there an alternative to ajax?

9 Jul 2013, 7:31 AM
If your data is fixed on the file-system it'd be easiest just to hard-code it into a JS file.

9 Jul 2013, 7:58 AM
Sorry I misunderstood your question. The webpages are on the filesystem, and I want to eventually source the data from a database by executing a php script but I was just currently testing it from reading a json file.

I'll try to execute a php script instead. What proxy type is best suitable for that?

9 Jul 2013, 8:04 AM
The proxy doesn't care whether you're using PHP, any of the subclasses of Server proxy are viable options depending on how you implement the data transfer. However, Ajax proxy and a Json reader are probably a good place to start. A Rest proxy may also be worth considering. Other proxies to handle specific use cases are available.

9 Jul 2013, 8:06 AM
Alright, sounds good. But the webpages have to be running from a webserver in order to use ajax right?

9 Jul 2013, 8:11 AM

If you want the pages to be on the file-system you could try JSON-P but the data would still need to be served up via PHP or some other compliant server implementation.

You might be able to use CORS for this but I'm not sure whether it works in the file-system case.

If you possibly can then save yourself a lot of effort and put everything under a webserver. You'll be hitting security restrictions all the way if you don't.

9 Jul 2013, 8:19 AM
If you want to use Ajax with your filesystem you'll need this override:

// http://www.sencha.com/forum/showthread.php?10621-Why-Ajax-can-not-get-local-file-while-prototypejs-can&


parseStatus : function (status) {
var result = this.callOverridden(arguments);
if (status === 0) {
result.success = true;
return result;

9 Jul 2013, 9:10 AM
As far as I'm aware Chrome doesn't support file-system Ajax requests without a hacky command-line flag:


Other browsers are a bit more lenient but it's still better avoided.

10 Jul 2013, 2:59 AM
Do you have the JSON MIME type added to your server?