Using last.fm API in javascript

I have very little experience with web development. I have little experience with HTML and am learning JavaScript right now. I created a Java program using the last.fm library for Java. I was able to get information about the user, information about the artist and information about the venue. Now I want to try and do it on the webpage where my problem arises.

I am using javascript last.fm api here http://github.com/fxb/javascript-last.fm-api I downloaded all the .js files and they are in the same directory as my .htm file.

This is my code so far.

<html>
<body>
<script type="text/javascript" src="lastfm.api.md5.js"></script>
<script type="text/javascript" src="lastfm.api.js"></script>
<script type="text/javascript" src="lastfm.api.cache.js"></script>

<script type="text/javascript">
var cache = new LastFMCache();

var lastfm = new LastFM({
apiKey : 'c9946d11aaaaaaaaaaaaaaaaaaaaaaaace',
apiSecret : '9dabf9aaaaaaaaaaaaaaaaxxx11ec3c7a993',
cache : cache
});

lastfm.artist.getInfo({artist: 'The xx'}, {success: function(data){
/* Use Data */
    }, error: function(code, message){
    /* Show error message. */
 }});

</script>
</body>
</html> 

.js, , . lastfm , lastfm. document.write(lastfm.apiKey), undefined, .

, getInfo "The xx" , . , , , , JSON. , ?

+3
2

, , /* *, , data.bio. alert(data), , .

JavaScript, ​​ FireBug, , .

+4

, . console.log() , , fm

0

Source: https://habr.com/ru/post/1751802/


All Articles