for some reason the initialise function isn't being called when I call my jQuery plugin, this seems to work as expected on another plugin I have created.
Plugin:
(function($) {
$.fn.youtubeVids = function( options ) {
var settings = $.extend({
num: 1,
id: 'UCeNOYP-TQK-3P3JZerCjheQ',
elm: null
}, options );
function initialize() {
console.log('dsad');
$.ajax({
url: "channel-videos.php",
data: { num: settings.num, id: settings.id },
success: function(data) {
if (settings.elm !== null) {
console.log("test");
} else {
console.log("uh oh");
}
},
dataType: "json"
});
}
};
}(jQuery));
Call to the plugin:
<script src="/js-src/youtube-min.js"></script>
<script>
$("#vid1").youtubeVids({
num: 3,
elm: [ "#vid1", "#vid2", "#vid2" ]
});
</script>