1. #1
    Sencha User
    Join Date
    Jul 2013
    Posts
    7
    Vote Rating
    0
    wdieujus is on a distinguished road

      0  

    Default Unanswered: Access Is Denied - proxy ajax

    Unanswered: Access Is Denied - proxy ajax


    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'
    }
    }
    });


    data/users.json:
    {
    "success": true,
    "users": [
    {
    "name": "James",
    "email": "james@gmail.com
    },
    {
    "name": "Bill",
    "email": "Bill@gmail.com
    }
    ]
    }

  2. #2
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,572
    Answers
    540
    Vote Rating
    309
    skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future

      0  

    Default


    Which other browsers have you tried?

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

  3. #3
    Sencha User
    Join Date
    Jul 2013
    Posts
    7
    Vote Rating
    0
    wdieujus is on a distinguished road

      0  

    Default


    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?

  4. #4
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,572
    Answers
    540
    Vote Rating
    309
    skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future

      0  

    Default


    If your data is fixed on the file-system it'd be easiest just to hard-code it into a JS file.

  5. #5
    Sencha User
    Join Date
    Jul 2013
    Posts
    7
    Vote Rating
    0
    wdieujus is on a distinguished road

      0  

    Default


    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?

  6. #6
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,572
    Answers
    540
    Vote Rating
    309
    skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future

      0  

    Default


    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.

  7. #7
    Sencha User
    Join Date
    Jul 2013
    Posts
    7
    Vote Rating
    0
    wdieujus is on a distinguished road

      0  

    Default


    Alright, sounds good. But the webpages have to be running from a webserver in order to use ajax right?

  8. #8
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,572
    Answers
    540
    Vote Rating
    309
    skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future

      0  

    Default


    Yes.

    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. #9
    Sencha - Community Support Team mankz's Avatar
    Join Date
    Nov 2007
    Location
    Stockholm, Sweden
    Posts
    2,731
    Answers
    33
    Vote Rating
    104
    mankz is a name known to all mankz is a name known to all mankz is a name known to all mankz is a name known to all mankz is a name known to all mankz is a name known to all

      0  

    Default


    If you want to use Ajax with your filesystem you'll need this override:


    // http://www.sencha.com/forum/showthre...ototypejs-can&
    Code:
    Ext.data.Connection.override({
    
        parseStatus : function (status) {
            var result = this.callOverridden(arguments);
            if (status === 0) {
                result.success = true;
            }
            return result;
        }
    });

  10. #10
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,572
    Answers
    540
    Vote Rating
    309
    skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future

      0  

    Default


    As far as I'm aware Chrome doesn't support file-system Ajax requests without a hacky command-line flag:

    https://code.google.com/p/chromium/i...etail?id=40787

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

Thread Participants: 3

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi