[英]send a ajax GET request to a https website with username and password
我想访问一个网站并使用“ajax调用”从中获取锚标签,如下所示:
$.ajax({
url: 'https://www.facebook.com/',
type: 'GET',
success: function(res) {
var headline = $(res.responseText).find('a').text();
alert(headline);
}
});
但我的标题是空白的。 但是我在“http”网站上尝试了相同的代码,它工作正常。
这是因为https
与http
不同,Facebook 就像许多其他网站一样使用 cookie 进行身份验证。 您必须首先在https://facebook.com
进行身份验证,然后才能取回数据。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.