I was just curious what’s the best way to store data for use by JQuery – I’m setting up a basic mp3 player, and the title, artist, track and file name all need be held somewhere to be retrieved by JQuery upon clicking in the radio interface. I was thinking of storying them as simple attributes within an tag, like this:
<a href="{song_file}" data-title="{song_title}" data-artist="{song_artist}" data-album="{song_album}">
but I’m guessing that might be considered bad form. I know I could bring them in via XML, but I’d rather not have to retrieve from some external document. Anybody have a good solution?
I believe what you are looking for is jQuery’s
.data(): http://api.jquery.com/jQuery.data/Here is one possible way it can be done: