A
abrtlt
I would like to have a web page in which, when the user clicks on any
of several specific elements, a specific audio file is played, without
reloading the page.
The specific audio file name is obtained from a PHP script (accessing
a MySQL database) that could be called using XMLHttpRequest and
JavaScript would write in a "div" tag an "embed and play" HTML tag
containing the audio file name.
I am not sure this would work, as the embed tag is HTML and will not be
executed as the page has already been loaded. In any case, unless I am
mistaken, JavaScript in the web page can handle only a text or XML
response, and thus I can get the audio file name, but not the file
itself. I can't pre-embed all audio files in the page because there are
too many (that is why I use MySQL to index them).
Is there any way to get round this?
Thanks!
Andrew
of several specific elements, a specific audio file is played, without
reloading the page.
The specific audio file name is obtained from a PHP script (accessing
a MySQL database) that could be called using XMLHttpRequest and
JavaScript would write in a "div" tag an "embed and play" HTML tag
containing the audio file name.
I am not sure this would work, as the embed tag is HTML and will not be
executed as the page has already been loaded. In any case, unless I am
mistaken, JavaScript in the web page can handle only a text or XML
response, and thus I can get the audio file name, but not the file
itself. I can't pre-embed all audio files in the page because there are
too many (that is why I use MySQL to index them).
Is there any way to get round this?
Thanks!
Andrew