Reputation: 79
Let's say I know a class id, is it possible to read the HTML data and write as a string the HTML that contacts that class id?
Doesn't have to be concrete code for this, any resources are appreciated that may make this possible. I'm unsure if there are any javascript functions that allow this.
Upvotes: 0
Views: 79
Reputation: 5097
If you are accessing this from another site and assuming you have CORS setup to allow the request, you can use jQuery's get()
to fetch the item:
$.get('https://example.com/path/to/page.html')
.then(function(data){
var elem = $(data).find('yourSelector');
/*
Do something with the element
*/
});
This also assuming that the element is always on the page and the page always resolves.
Upvotes: 1