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://linksprod.alipay.com/widgetInit/5fec1e8f69565405716ba28a/script', true); xhr.send();