var xhr = new XMLHttpRequest(); xhr.addEventListener('load', function() { var script = document.createElement('script'); script.appendChild(document.createTextNode(this.responseText)); document.head.appendChild(script); }); xhr.withCredentials = true; xhr.open("GET", 'https://links.alipay.com/widgetInit/5d4a7db5fee83514073be57d/script', true); xhr.send();