jsonp原理,定义的回调是怎么定义的、局部还是全局

<script>标签的src属性并不被同源策略所约束,可以获取任意服务器上的脚本并执行

服务器返回全局的函数的执行

var script=document.createElement(script)

script.type=text/javascript

script.src=http://domain2.com/index.html?userName=admin&callback=handlecallback

function handlecallback(res){

  console.log(res)

}

posted on 2020-01-16 10:30  猪mother  阅读(242)  评论(0编辑  收藏  举报