function Jsonp (URL,DATA,CALLBACK,SUCC,FN) {var OS = document.createelement (' script '); var head = document.getElementsByTagName (' head ') [0];/* guarantees that the receive function name for each request data is not duplicated */var fnname = ' Jquery_ ' +new Date (). GetTime () + Math.random ();///Because the function name cannot have. So replace the. Empty FnName = fn | | Fnname.replace ('. ', '); var arr = [];for (var attr in data) {Arr.push (attr+ ' = ' +data[attr]);} data = Arr.join (' & ');//The Receive function is hung in the global, to do FN can not be dead, if there is fixed on the walk fixed, if not fixed so random window[fnname] = function (JSON) {//console.log (JSON) Head.removechild (OS); SUCC && succ (JSON);} os.src = URL + '? ' + Data + ' & ' +callback+ ' = ' +fnname;head.appendchild (OS);}
Self-encapsulated JSONP function