Question

Hi have the following function:

function last()
{
    /* Create a cache object */
    var cache = new LastFMCache();
    alert("test");

    alert("test2");
    /* Load some artist info. */
    lastfm.artist.getInfo({artist: 'The Killers'}, {success: function(data){
        alert(data.bio);
        $('gallery').append(data.to_html('<p>${bio}</p>'));
    }, error: function(code, message){
        /* Show error message. */
    }});
}

alert(data.bio) shows up as undefined. How would I check what data is being held and how can I used and format it correctly on my webpage?

Was it helpful?

Solution

How would I check what data is being held?

  • Get Firefox, if you don't have it. Install Firebug. Bring up Firebug by pressing F12. Click on the Console tab. Put console.log(data); in your success callback function. Run the code, and inspect the contents at your heart's content. I recommend Firefox as having a superior object browser to Chrome, but you can also...
  • Get Chrome. Its debugger is built in. press F12. Click on the Console tab. Do the same thing as I said for Firefox.

Knowledge acquired!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top