我有这个AJAX请求:
function getLinks(cn) {
$.ajax({
url: cn,
error: function() {
console.log('error');
},
success: function(data) {
console.log(data);
return data;
},
type: 'get',
headers: {
'Access-Control-Allow-Origin': '*'
}
});
}
var insecure_links = getLinks(url);
但每当我运行它时,它总是会扫描localhost:8080/google.com
而不是google.com
(我只想让res成为该页面的html)
问题:我如何修改这个以便我可以对某个页面发出get请求并接收该页面的HTML?
如果有帮助,我会在Nodejs上这样做。
答案 0 :(得分:-1)
您必须将cn
作为google.com
传递,这可能在浏览器栏中有效但不是自己的有效网址。这导致它在当前文件夹中查找名为Google.com的文件。而是将cn
作为http://google.com