I use this plugin so that I can show what I'm listening to live on my site: https://github.com/derekmartinez18/Simple-Ajax-Spotify-Now-Playing
Part of JavaScript will work on loading a page that connects to PHP, which through the API checks that I am listening, captures the title, etc., if it is successfully sent back to JavaScript and displayed via HTML.
I repeated what PHP gets and can see how it correctly captures all the latest songs, names, etc. Therefore, since nothing appears on the page, it may be JavaScript. I pasted it below using the pastebin link to php too.
Javascript
<script type="text/javascript">
function get_spotify() {
$.ajax({
type: 'POST',
url: '/Scripts/last.fm.php',
data: { request: 'true' },
success: function(reply) {
$('.now-playing').html("<p>" + reply + "</p>");
}
});
}
window.onload = get_spotify;
</script>
Pastebin of PHP - http://pastebin.com/eZUH6BNU
API, PHP ( , .):
{"recenttracks":{"track":[{"artist":{"#text":"LMFAO","mbid":"ed5d9086-e8cd-473a-b96c-d81ad6c98f0d"},}
Live Link - http://bit.ly/1ewTe8l