Skip to content

Instantly share code, notes, and snippets.

@ihatecsv
Created August 28, 2015 18:34
Show Gist options
  • Save ihatecsv/1facde1f452e3b4c7546 to your computer and use it in GitHub Desktop.
Save ihatecsv/1facde1f452e3b4c7546 to your computer and use it in GitHub Desktop.
song = "";
setInterval(function() {
if (song != $('#track-name').find('a').text().replace(/ /g, "~") + '|' + $('#track-artist > a').text().replace(/ /g, "~")) {
song = $('#track-name').find('a').text().replace(/ /g, "~") + '|' + $('#track-artist > a').text().replace(/ /g, "~");
$.ajax({
//The URL to process the request
'url': 'https://your.webserver/relay.php?m=' + song,
'type': 'GET',
'success': function(data) {
if (data == "success") {
console.log('request sent!');
}
}
});
console.log(song);
}
}, 2000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment