PDA

View Full Version : Ext.Ajax.request Problem



notinotinoti
12 Jul 2010, 4:03 AM
Hello,

I hard to find solve this problem. But I could not.

Please help me.


My code is




var makeAjaxRequest = function() {
Ext.Ajax.request({
url : 'test.json',
success: function ( result, request ) {
alert("Success: "+result.responseText);
},
failure: function ( result, request) {
alert("Failed: "+result.responseText);
}
});
};



Continually alert message("Failed:") show me.

T.T

evant
12 Jul 2010, 5:31 AM
Failure indicates that the http request failed. Interrogate the response object to find out the error code.



console.log(response.status, response.statusText);

notinotinoti
12 Jul 2010, 3:34 PM
Um.... I tried to indicate failure log massage.

Like this :

console.log(result.status, result.statusText);



But console log showed me

-------------
0 ""
-------------


:-( Do you know what is wrong?

I used crome.

notinotinoti
12 Jul 2010, 4:18 PM
Oh!!!! I solve this problem.

I usually execute code by dragging html file into crome.

At this time, code is not operate.

But, execute code by clicking run-button in aptana application,

the code could operate.


What is different between both situation? -_-;

(I`m sorry about pool my English skill...)

evant
12 Jul 2010, 5:11 PM
Ajax will only work if you run it through a web server.

If you drag the file into chrome, it probably runs it as "file://" instead of "http://localhost/..."

notinotinoti
12 Jul 2010, 5:38 PM
Thank you very much^_^