List all links in ajax callback
I want to make a list of all links per 'content' item but I can only figure out how to get ALL links on a page EXCEPT for the ones retrieved via the AJAX query. How can I search for all links within a variable?
- $.ajax({
context: this,
url: url,
method: "GET",
headers: { "Accept": "application/json; odata=verbose" },
success: function (data)
{
for(i = 0; i < data.d.results.length; i++)
{
var content = data.d.results[i].PublishingPageContent;
$("a").each(function() {
var link = $(this).attr("href");
console.log(link); // this lists all links on the page, but not the ones in 'data'
})
}
}
});