ove*_*low 26 jquery ruby-on-rails ruby-on-rails-3 magnific-popup
我正在尝试实现宏大的弹出窗口
我有以下链接 <a class="simple-ajax-popup" href="/index.json">load json</a>
当我点击链接时,灯箱处于加载状态并抛出异常
Uncaught TypeError: Cannot call method 'createDocumentFragment' of undefined
我正在使用rails 4,我也有jquery-fileupload插件,但它正在工作.
请阅读此文档:内容类型
您不能将 json 用作 html。您应该将 json 包装为 html。你能做什么?
像这样的东西:
$.magnificPopup.open({
items: {
src: '<div class="white-popup">Dynamically created popup</div>', // can be a HTML string, jQuery object, or CSS selector
type: 'inline'
callbacks: {
open: function() {
$.getJSON("/index.json").done(function( data) {
data.each( function(index, value) {
$("div.white-popup").append(value);
});
})
},
close: function() {
// Will fire when popup is closed
}
});
Run Code Online (Sandbox Code Playgroud)
我希望它有帮助。
| 归档时间: |
|
| 查看次数: |
2363 次 |
| 最近记录: |