Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #21937
| From | Denis McMahon <denismfmcmahon@gmail.com> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Re: Using html5 data attribute |
| Date | 2013-11-08 17:49 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <l5j87f$qag$2@dont-email.me> (permalink) |
| References | <167ecvxd9ci26$.dn66xn5j59bv.dlg@40tude.net> |
On Fri, 08 Nov 2013 09:26:12 -0500, richard wrote: > <a class='aplay' href='http://mroldies.net/index.php?tune=20' > data-src='http://mroldies.net/200/6020.mp3'> > > This is an example of the links I use to produce my playlist. > The current javascipt recovers the information from data-src. > So I got to thinking, what if I have this instead? > > <a class='aplay' href='#' data-src='http://mroldies.net/200/6020.mp3' > data-info="6020"> > > Problem is, I have seen dozens of sites discuss the recovery of the > attribute. But then, they leave out how you use it. > Such as the simple act of printing that information. If it's a string, you can print it the same as any other string, which in a dom environment usually means setting up a text node and appending it as a child node to a relevant block element. > The php page contains the full array so there is no database involved. > I want to match photos with the current playing song. > The way I have it set up, photo names abd song names are equal. > i.e. 6020.mp3 will pair with 6020.jpg. > > So how do I do this? Sounds like you need to find a mechanism to pass the data from the php page to the javascript on the client machine. Now in theory you should be able to serialise a php array into a json data structure, and output that json data structure in the web page in such a way that your javascript code on the web page has access (in it's javascripty way) to the same data. -- Denis McMahon, denismfmcmahon@gmail.com
Back to comp.lang.javascript | Previous | Next — Previous in thread | Find similar | Unroll thread
Using html5 data attribute richard <noreply@example.com> - 2013-11-08 09:26 -0500
Re: Using html5 data attribute Ben Bacarisse <ben.usenet@bsb.me.uk> - 2013-11-08 17:04 +0000
Re: Using html5 data attribute Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-11-08 18:37 +0100
Re: Using html5 data attribute Ben Bacarisse <ben.usenet@bsb.me.uk> - 2013-11-08 18:36 +0000
Re: Using html5 data attribute John Harris <niam@jghnorth.org.uk.invalid> - 2013-11-09 09:59 +0000
Re: Using html5 data attribute Denis McMahon <denismfmcmahon@gmail.com> - 2013-11-08 17:49 +0000
csiph-web