2020-02-05 代码片段►JavaScript 原生js中jsonp跨域实现调用必应每日壁纸API Tips: 注意jsonp跨域需要后台支持。 必应壁纸接口: https://github.com/xCss/bing 1234567891011function setBingImage(){ let script = document.createElement('script'); bing = { bg: function (data) { body.style.backgroundImage = `url('${data.data.url}')`; } } script.src = `https://bing.ioliu.cn/v1/?d=0&w=1920&h=1080&callback=callback`; document.querySelector("head").appendChild(script); document.querySelector("head").removeChild(script);} 前一篇 原生js module中的函数无法在HTML中绑定解决方案 后一篇 使用JSONP跨域失败问题解答