Quotes help make search much faster. Example: "Practice Makes Perfect"

Thursday, February 6, 2014

Codecademy Deezer API 4/6


<!-- Sample Solution -->

<!DOCTYPE html>
<html>
<head>
    <script src="http://cdn-files.deezer.com/js/min/dz.js"></script>
</head>

<body>
    <div id="dz-root"></div>
   
    <input type="button" onclick="search();" value="Search"/>
    <ul id="results">
    </ul>
   
    <script>
        DZ.init({
            appId  : '122865',
            channelUrl : 'http://external.codecademy.com/channel.html',
        });

        function search(){
            DZ.api('/search?q=sting', function(json){
                for (var i=0, len = json.data.length; i<len ; i++)
                {
                  $('#results').append('<li>' + json.data[i].title + ' - ' + json.data[i].album.title + '</li>');
                }
            });
        }
    </script>
</body>
</html>

No comments:

Post a Comment


This is an example of scrolling text using Javascript.

Popular Posts