的fancybox - 显示Ajax内容? [英] fancybox - show ajax content?

查看:149
本文介绍了的fancybox - 显示Ajax内容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我上有一个点击事件的锚标记

I have an anchor tag with a click event on it

$('a').click(function(){
  $.ajax({
    url:     'ajax/test.php',
    data:    {id: 123, count: 456},
    success: function(data) {
               //lightbox data
             }
  });
});

响应看起来像

The response will look something like

{
  title: 'My Title',
  body:  'My Body'
}

我想在的fancybox表明这一点。

I want to show this in a fancybox.

我在哪里卡住的创建和显示周围飞?

Where I am stuck is creating and showing a fancybox around this content on the fly?

推荐答案

您是否尝试过这样的事情?

Have you tried something like this?

success: function(data) {
  $.fancybox({
    'content' : '<h1>' + data.title + '</h1>' + data.body
  });
}

这篇关于的fancybox - 显示Ajax内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆