I need to develop this kind of application, i’m using php and mysql
first i query the database for the words(words table) , then using this words i fill a list on the page which is displayed to the end user, when the user is clicking one of the words on that list, on the right side of the page a video should start playing according to that word clicked, link to that video is stored in mysql database , in the same table(words table) i have mentioned earlier.
help me to achieve this task please? if i can do it without page refreshing(using ajax) that would be better?
regards,
Rangana
This is a quick “skeleton” of how I would do it.
I would start by querying the DB with something like this
Then you create the list
Then you create an array with ids and URLs of the videos through an AJAX call in JS
Finally just bind some click events to the links
Using JQuery, for instance (see running demo)
Obviously instead of doing an alert you will find out the corresponding URL from the array you built in point 3 and then show it in the HTML.
EDIT:
To embed the video, you could use an
objecttag, which you would generate dynamically.Another live example here (I’m linking to Youtube videos there, but the idea is the same with local files)