1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
(function(d,e,j){$.fn.load=function(url,o,cb){
var p,q=[],c=o, h, f=function(){ $.each(q,function(i,s){ if(h&&s)$('head').append(s)}) };
if(!$.isFunction(o)){ c=cb; }
p=$.isArray(o.js)?o.js:o.js?[o.js]:[];
o=o.data||null;
cb=function(){ h=true; f(); c.apply(this,arguments); };
$.each(p,function(i,u){
$.ajax({type:"GET",dataType:"text",url:u,complete:function(x){
var s=d.createElement(e); s.text=x.responseText; q[i]=s; f();
}});
q[i]=null;
});
j.call(this,url,o,cb);
}})(document,'script', $.fn.load); |
Partager