服务器不允许跨域,只能使用$.ajax jsonp
$.ajax({
url: `https://api.douban.com/v2/movie/search?q=${res.title}`,
type: "GET",
dataType: "jsonp", //返回的数据类型,设置为JSONP方式
success: function(result, status, xhr) {
}
})
因为xmlhttprequest不支持修改包头文件,所以不能跨域请求
服务器不允许跨域,只能使用$.ajax jsonp
$.ajax({
url: `https://api.douban.com/v2/movie/search?q=${res.title}`,
type: "GET",
dataType: "jsonp", //返回的数据类型,设置为JSONP方式
success: function(result, status, xhr) {
}
})
因为xmlhttprequest不支持修改包头文件,所以不能跨域请求
本文标题:跨域
本文链接:https://www.haomeiwen.com/subject/jzenoxtx.html
网友评论