I'm trying to use my own function (never liked $(document).ready()) to dynamically load an embed from an URL.
I'm trying like this:
function video(donde,url) {
$("#"+donde).oembed(url);
return false;
}
And an example of use would be:
<div class="texto">
[my title]
<span style="float: right;">
<img onclick="video('video68084','http://www.youtube.com/watch?v=ORZTCQjAuZY');" src="http://i1.ytimg.com/vi/ORZTCQjAuZY/default.jpg" alt="preview" onerror="this.src='images/linket.png';" class="caja_con_sombra" style="width: 80px; height: 60px;"> </span>
<div style="float: left; width: 76%;">
[my description]
</div>
<div id="video68084"></div>
</div>
Which jumps:
b.type is not a function
[Interrumpir en este error] b.ready);var j=false;try{j=E.frameElem...ow(j))return false;if(j.constructor&&
Onclick vía firebug :(
Any idea what I'm missing? The error source file is jquery.min.js :S
You're not missing anything, you found a bug in the oembed plugin. Nice find, maybe you have a future career in quality assurance :)
Looks like both oembed and jQuery want to use
.typebut jQuery is ending up with oembed's string.typewhere it wants its own function.type.The oembed plugin works fine with jQuery-1.3.2 but breaks as of jQuery-1.4.3.
You can pull a functional version of the oembed plugin from this jsfiddle: http://jsfiddle.net/ambiguous/ZVhUn/1/
This problem has been reported several times but the oembed author doesn't seem to be listening. Here's a fixed version of the plugin if you want it:
The only change is that I replaced
var oembed = $.extend(data);withvar oembed = $.extend({ }, data);inthis.embedCodeat the bottom of the file.