Dropzone JS:响应不解析 facebook 视频 iframe
Dropzone JS: Response not parsing facebook video iframe
我正在使用 dropzone js 脚本将文件上传到 facebook。文件上传成功。作为回应,我返回了一些 html,其中包括显示 facebook 视频的代码:
<div class="fb-video"
data-href="https://www.facebook.com/facebook/videos/<?= $video->youtube_id; ?>/"
data-width="auto" data-show-text="true">
</div>
使用 Dropzone 触发上传的代码是:
$(document).ready(function() {
Dropzone.options.myVideoDropzone = {
acceptedFiles: 'video/*',
processing: function(obj, resp) {
$('.upload-feedback').removeClass('error');
$('.upload-feedback').removeClass('success');
$('.upload-feedback').html('Uploading ...');
},
error: function(obj, resp) {
$('.upload-feedback').addClass('error');
$('.upload-feedback').html('Upload error. Please try again.');
},
success: function(obj, resp) {
try {
var response = JSON.parse(resp);
if (response.status) {
$('.upload-feedback').addClass('success');
$('#list_videos').append(response.html);
$('#addvideo').closeModal();
}
} catch (e) {
$('.upload-feedback').addClass('error');
$('.upload-feedback').html('Error: ' + e);
}
this.removeAllFiles();
}
};
});
我看到附加的项目,但 iframe 没有加载视频。我的猜测是 html 响应未被解析。有什么建议吗?
我缺少解析代码前缀使用:
FB.XFBML.parse();
代码如下:
try {
var response = JSON.parse(resp);
if (response.status) {
$('.upload-feedback').addClass('success');
$('#list_videos').append(response.html);
FB.XFBML.parse();
$('#addvideo').closeModal();
}
} catch (e) {
$('.upload-feedback').addClass('error');
$('.upload-feedback').html('Error: ' + e);
}
我正在使用 dropzone js 脚本将文件上传到 facebook。文件上传成功。作为回应,我返回了一些 html,其中包括显示 facebook 视频的代码:
<div class="fb-video"
data-href="https://www.facebook.com/facebook/videos/<?= $video->youtube_id; ?>/"
data-width="auto" data-show-text="true">
</div>
使用 Dropzone 触发上传的代码是:
$(document).ready(function() {
Dropzone.options.myVideoDropzone = {
acceptedFiles: 'video/*',
processing: function(obj, resp) {
$('.upload-feedback').removeClass('error');
$('.upload-feedback').removeClass('success');
$('.upload-feedback').html('Uploading ...');
},
error: function(obj, resp) {
$('.upload-feedback').addClass('error');
$('.upload-feedback').html('Upload error. Please try again.');
},
success: function(obj, resp) {
try {
var response = JSON.parse(resp);
if (response.status) {
$('.upload-feedback').addClass('success');
$('#list_videos').append(response.html);
$('#addvideo').closeModal();
}
} catch (e) {
$('.upload-feedback').addClass('error');
$('.upload-feedback').html('Error: ' + e);
}
this.removeAllFiles();
}
};
});
我看到附加的项目,但 iframe 没有加载视频。我的猜测是 html 响应未被解析。有什么建议吗?
我缺少解析代码前缀使用:
FB.XFBML.parse();
代码如下:
try {
var response = JSON.parse(resp);
if (response.status) {
$('.upload-feedback').addClass('success');
$('#list_videos').append(response.html);
FB.XFBML.parse();
$('#addvideo').closeModal();
}
} catch (e) {
$('.upload-feedback').addClass('error');
$('.upload-feedback').html('Error: ' + e);
}