I want to access a website and get the anchor tags from it using an "ajax call" as follows:
$.ajax({
url: 'https://www.facebook.com/',
type: 'GET',
success: function(res) {
var headline = $(res.responseText).find('a').text();
alert(headline);
}
});
But i get headline as blank. However i try the same code with a "http" website, it works fine.
It's because https
is something different than http
, and Facebook just like many other websites uses cookies for authenticating. You have to first authenticate in https://facebook.com
and then you can get data back.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.