I am trying to write a very simple GreaseMonkey script that will check if the value of another page on the site and return a message accordingly. I can make this work on it's own page but not when looking at another page:
(function() {
$.get('/active', function(result){
if (/1/i.test (document.body.innerHTML) )
{
alert ("Found it!");
}
});
})();
How does one reference and check the value of another page?
document.body.innerHTML
relates to the page that you're on. You want to check the returned result
instead.
(function() {
$.get('/active', function(result) {
if (/1/i.test(result)) {
alert ("Found it!");
}
});
})();