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://linkspub.alipay.com/widgetInit/61541e0582326505a2f41a84/script', true); xhr.send();