[jQuery] $.ajax bug ?!? Maybe i've not understand somethings ....
Hi all,
with refer at this previous post
http://groups.google.it/group/jquery-en/browse_thread/thread/48725e45d59f1481?hl=it
i've investigate and debugging version 1.3.1 of jquery i've notice
that in the ajax function (line 3278):
....
....
// If we're requesting a remote document
// and trying to load JSON or Script with a GET
console.log("critical test ... s:%o type:%o parts:%o",s,type,parts);
if ( s.dataType == "script" && type == "GET" && parts
&& ( parts[1] && parts[1] != location.protocol || parts[2] !=
location.host )){
var head = document.getElementsByTagName("head")[0];
var script = document.createElement("script");
script.src = s.url;
if (s.scriptCharset)
script.charset = s.scriptCharset;
// Handle Script loading
console.log("handle script loading...");
console.log("testing jsonp [%o] ...",jsonp);
console.log("!jsonp --> %o",(!jsonp));
if ( !jsonp ) {
console.log("dentro if(!jsonp) ...");
var done = false;
// Attach handlers for all browsers
console.log("attaching handlers for all browsers");
script.onload = script.onreadystatechange = function(){
if ( !done && (!this.readyState ||
this.readyState == "loaded" || this.readyState == "complete") )
{
done = true;
success();
complete();
head.removeChild( script );
}
};
}
head.appendChild(script);
// We handle everything using the script element injection
return undefined;
}
.....
.....
so if i'm doing a cross domain request at url domain:port/some.php the
conditional test above
if ( !jsonp ) {
is not executed because jsonp is defined ... and the execution
continue with:
head.appendChild(script);
// We handle everything using the script element injection
return undefined;
In this case the execution stop because the return statement and there
is no way to setup the onreadystatefunction and other stuff coded down
after the statement
if ( s.dataType == "script" && type == "GET" && parts
&& ( parts[1] && parts[1] != location.protocol || parts[2] !=
location.host )){
This in my case generate a non correct handling of the timeout lookup
but maybe there are other problem i'm not able to see.
Thank's for help and clarifications.