function jsonp(url,data,callback){ var script = document.createElement("script"); document.body.appendChild(script); data = data || {}; data.callback = "cb"+new Date().getTime(); //绑定callback回调函数到全局 window[data.callback] = callback; //$.param为jquery序列化JSON的方法 url += "?"+$.param(data); script.src= url; //callback执行完,则可以将script移除了 script.onLoad = function(){ document.body.removeChild(script); } }原文链接:https://www.f2er.com/json/289478.html