如何在 document.ready 之后在页面中包含嵌入的 YouTube 频道?
我有一个来自某家公司的 YouTube 嵌入频道,下面有一个其他相关公司的链接列表,但这只是我页面上的一个小部件,所以当我单击列表中的链接时,我想获得新的嵌入内容来自另一家公司的 youtube 频道,带有 ajax 调用。我尝试运行从 youtube api 获取的脚本,但它无法加载,我还尝试将脚本放入 div 中,然后将 div 插入小部件中,但仍然没有成功。有谁知道我该怎么做?
这是我从 youtube 获得的用于嵌入频道的脚本:
<div style="padding-bottom:10px" id="divYoutubeTab">
<script type="text/javascript" src="http://www.gmodules.com/ig/ifr?url=http://www.google.com/ig/modules/youtube.xml&up_channel=opelblog&synd=open&w=880&h=390&title=&border=%23ffffff%7C3px%2C1px+solid+%23999999&output=js"></script>
</div>
我想单击一个链接,在 onclick 函数上我只需更改频道名称,频道应该重新加载到新频道..但我不能。 ajax 调用只是为了从我的数据库中获取频道名称
i have a youtube embedded channel from a certain company, and below i have a list of links to other related companies, however this is just a widget on my page, so when i click a link in the list i want to get the new embedded youtube channel from the other company with an ajax call. i've tried running the script that i got from the youtube api but it does not load, i've also tried putting the script inside a div and then inserting the div in the widget and still no luck. does anyone have an idea how i can do this?
so this is the script i got from youtube for embedding a channel:
<div style="padding-bottom:10px" id="divYoutubeTab">
<script type="text/javascript" src="http://www.gmodules.com/ig/ifr?url=http://www.google.com/ig/modules/youtube.xml&up_channel=opelblog&synd=open&w=880&h=390&title=&border=%23ffffff%7C3px%2C1px+solid+%23999999&output=js"></script>
</div>
i would like to click a link and on the onclick function i just change the channel name and the channel should reload to the new channel .. but i can't. the ajax call is just to get the name of the channel from my database
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以查看以下项目:
You could have a look at the following projects:
我自己尝试过 jsfiddle,这显然是页面加载后引入脚本的问题。
虽然我无法自己创建解决方案...
这可能就是您的答案寻找
I had a go myself on jsfiddle and its obviously an issue with introducing script after the page has loaded.
While I could not create a solution myself...
THIS may be the answer you are looking for