I haven't really found anything about this. I want to read data from a website. From my webpage I can read a div's value with
<div class="tools">hammer</div>
var divs = document.getElementsByTagName("div");
for(var i=0; i<divs.length; i++ ) {
if(divs[i].className == "tools") {
alert(divs[i].innerHTML);
}
}
Is it possible to set the URL of the desired webpage so this code would scrape that page? I know the classname and the url.
Based on @cereallarceny's answer I created this code block but I see no alert when running the script:
$.ajax({
type: 'get',
url: 'https://play.google.com/store/apps/details?id=com.viber.voip',
crossDomain: true, //Very important, ensures you can get data from a domain that isn't your own!
success: function() {
var divs = document.getElementsByTagName("div");
for(var i=0; i<divs.length; i++ ) {
if(divs[i].className == "votes") {
alert(divs[i].innerHTML);
}
}
}
});