Hi everyone,
I have some trouble getting this to work, I’m trying to grab the Vimeo video thumbnail value to use it further down the javascript lines.
<script>
......
if( source == 'vimeo' )
{
$.ajax({
url: 'http://www.vimeo.com/api/v2/video/' + videoid + '.json',
dataType: 'jsonp',
success: function(data)
{
thumbnail = data[0].thumbnail_medium;
}
});
}
else
if( source == 'youtube')
{
thumbnail = 'http://i4.ytimg.com/vi/' + videoid + '/mqdefault.jpg';
}
// test result
alert(thumbnail);
......
</script>
For some reason, the “thumbnail” value is not preserved outside the ajax call, I suspect it’s because I’m defining it wrongly. How would I go about doing it properly so that I could actually use the thumbnail value, please?