1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
| window[jsonp]=function(tmp){
data=tmp;
success();
complete();
window[jsonp]=undefined;
try {
delete window[jsonp];
}
catch(e){}
if(head)head.removeChild(script);};}
if(s.dataType=="script"&&s.cache==null)s.cache=false;
if(s.cache===false&&type=="GET"){
var ts=now();
var ret=s.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+ts+"$2");
s.url=ret+((ret==s.url)?(s.url.match(/\?/)?"&":"?")+"_="+ts:"");}
if(s.data&&type=="GET")
{
s.url+=(s.url.match(/\?/)?"&":"?")+s.data;s.data=null;
}
if(s.global&&!jQuery.active++)jQuery.event.trigger("ajaxStart");
var remote=/^(?:\w+:)?\/\/([^\/?#]+)/;
if(s.dataType=="script"&&type=="GET"&&remote.test(s.url)&&remote.exec(s.url)[1]!=location.host){
var head=document.getElementsByTagName("head")[0];
var script=document.createElement("script");
script.src=s.url;
if(s.scriptCharset)script.charset=s.scriptCharset;
if(!jsonp){
var done=false;
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);
return undefined;}
var requestDone=false;var xhr=window.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();
if(s.username)xhr.open(type,s.url,s.async,s.username,s.password);
else ... |
Partager