run script when loading a jquery page with a link

run script when loading a jquery page with a link


Hello and thank you in advance for your help.

I am creating a small mobile application for viewing videos. I want that on 
a click, they can perform an action. So instead of using an iframe from youtube
 I use the youtube API. As presented in the code page attached. I have two pages of sub-menus before accessing the page that contains the links
 to the videos (so the page is probably called in AJAX) The problem is that
when I run the page the video is not immediately created by the youtube API.
she does not appear; I need to refresh the page for it to work. After test
the warning message "hello" does not appear when the page is called from the
link. on the other hand once refreshed everything is ok. Here you are again
thank you
ben from France