Hybrid View

  1. #1
    Sencha User
    Join Date
    Dec 2013
    Posts
    84
    Answers
    6
    Vote Rating
    48
    Malte123 is infamous around these parts Malte123 is infamous around these parts

      0  

    Default Answered: Ext.Ajax.request response.status 0 but file is loaded

    Answered: Ext.Ajax.request response.status 0 but file is loaded


    Hey all :-)

    I try to load a file within base64 in ...

    PHP Code:
    Ext.Ajax.request({
                
    urlthis.configFileName,
                
    method'GET',
            
    //    binary: true,  // makes it more worse: no responseText in Output
                
    success: function(response) {
                    var 
    cfg Ext.decode(response.responseText);
                    
    loadSuccessHandler(cfg); // callback function given as param functioncall
                
    },
                
    failure: function(response) {
                  
    loadErrorHandler("Could not get "+this.configFileName+" - server response was " response.status); // this is 0
                  
    console.log(response); // 
                
    }
            }); 
    Output on console:
    XHR finished loading: "file:///Users/noman/Documents/workspace/fassade/tests/app/config/config.cfg?_dc=1388973757477".
    Could not get undefined - server response was 0
    |> Object
    In my opinion I shouldn't see content in responseText like this (if failure sayes status=0):
    HTML Code:
    responseText: WW91IGFyZSBhIHNub29weSBFeHRKUyBIZXJvIDotKQ0KUGxlYXNlIGhlbHAgbWUgdG8gZmluZCBhIHNvbHV0aW9uICENCkkgdm90ZSB5b3UgdXAgYW5kIHNlbGVjdCB0aGUgYmVzdCBhbnN3ZXIgb2YgY2F1c2UgIQ0KSWYgeW91IHZvdGUgbWUgYWxzbyB1cCBJIHdpbGwgcG9zdCBteSBzb2x1dGlvbiBpZiB0aGVyZSBpcyBubyBzb2x1dGlvbiBwb3N0ZWQgYnkgb3RoZXJzLg==
    If I activate the flag binary: true I will loose my responseText in Object (console.log .. see above)

    For this: Everything does the opposite thinks than I expected !!!

  2. This will only happen loading files directly off the filesystem. If you put this through a server it'll work fine.

    See the code for the parseStatus method of Ext.data.Connection. A code of 0 is treated as an error. This is not straightforward as 0 could mean success or failure and applies when a real status code is not available.

    If you really must work directly off the filesystem then you can override the relevant parts of Connection easily enough.

  3. #2
    Sencha User
    Join Date
    Jan 2013
    Location
    Germany, Freiburg i. Br.
    Posts
    31
    Answers
    4
    Vote Rating
    8
    StudentDaniel will become famous soon enough

      1  

    Default


    maybe you should use the failure-method to go forward with loadSuccessHandler(cfg);

  4. #3
    Sencha User
    Join Date
    Jan 2013
    Location
    Germany, Freiburg i. Br.
    Posts
    31
    Answers
    4
    Vote Rating
    8
    StudentDaniel will become famous soon enough

      1  

    Default


    try scope: this ... so your undefined should go away .. maybe this helps

  5. #4
    Sencha User
    Join Date
    Dec 2013
    Posts
    84
    Answers
    6
    Vote Rating
    48
    Malte123 is infamous around these parts Malte123 is infamous around these parts

      0  

    Default


    scope: this ... so your undefined should go away
    thanks for this Idea
    but this only results in

    XHR finished loading: "file:///Users/noman/Documents/workspace/fassade/tests/app/config/config.cfg?_dc=1388973757477".
    Could not get app/config/config.cfg - server response was 0
    |> Object
    it doesn't fix the main Problem

  6. #5
    Sencha User
    Join Date
    Jan 2013
    Location
    Germany, Freiburg i. Br.
    Posts
    31
    Answers
    4
    Vote Rating
    8
    StudentDaniel will become famous soon enough

      1  

    Default


    Is there a solution for this ? Or is this a bug ?
    I am interested in this - I could reproduce this !

  7. #6
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,499
    Answers
    527
    Vote Rating
    286
    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

      2  

    Default


    This will only happen loading files directly off the filesystem. If you put this through a server it'll work fine.

    See the code for the parseStatus method of Ext.data.Connection. A code of 0 is treated as an error. This is not straightforward as 0 could mean success or failure and applies when a real status code is not available.

    If you really must work directly off the filesystem then you can override the relevant parts of Connection easily enough.

Thread Participants: 2