Why is this video not being embedded?
Here's my application.js file:
$(document).ready(function() {
$('a.oembed').embedly({maxWidth:600,'method':'replace'});
});
Here's my show
view:
<div id="video_div"><%= link_to 'video', @video.video_url, :class => 'oembed' %></div>
The result is simply the link to the youtube video with the text "video". The video is not being embedded.
I input the link in my new
view and save @video.video_url
to the db.
I successfully include these files:
<script src="/javascripts/jquery.embedly.js?1299981574" type="text/javascript"></script>
<script src="/javascripts/jquery-1.4.2.min.js?1299978321" type="text/javascript"></script>
<script src="/javascripts/rails.js?12开发者_开发知识库99978356" type="text/javascript"></script>
<script src="/javascripts/application.js?1300064036" type="text/javascript"></script>
Try reordering the includes so that embedly is included after jquery. If you look at the javascript console in inspector/firebug you'll probably see that embedly can't find the jQuery variable.
精彩评论