Trouble with Youtube embed codes and AJAX
I'm working on a site that uses client video testimonials, but there's limited space to work with. I decided to try building an ajax function to reload the embedded video onclick, but it's not working.
The code (embed html + quotes) is generated by a seperate PHP script, and this function does replace the code just fine:
-
function newtestimonial()
{
$("#testimonial").empty();
$("#testimonial").load("http://path/to/testimonials.php");
}
However, the video itself doesn't load. A View Source confirms that the new code has been loaded, but I assume that Flash has to initialise the content on page load.
How do I get the video to reload properly? I don't want to use iFrames, and I don't want to use thumbnails.
Thanks in advance!