显示器的jQuery的fancybox为阿贾克斯成功 [英] display jquery fancybox as ajax success
本文介绍了显示器的jQuery的fancybox为阿贾克斯成功的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有:
- 的
< A HREF>
链接显示的fancybox 和 - 的
<形式GT;
,该网页上显示一个消息时subtmit按钮点击阿贾克斯成功。 他们都做工精细。
- the
<a href>
link that displays a fancybox and - the
<form>
, that displays a message on the page when subtmit button clicked on ajax success. They both work fine.
在code是如下。
<script>
$(document).ready(function ()
{ //this fancybox appears when <a href="..." ...>...</a> clicked
$(".fancybox-effects-d").fancybox({
padding:15,
closeBtn:true,
});
$("form#submit").submit(function ()
{
var name = $('#name').attr('value');
var password = $('#password').attr('value');
$.ajax({
type:"POST",
url:"index/success",
data:{ name:name, password:password},
success:function ()
{
//this form disappears and div appears when submit button of the <form id="submit" ...>...</form> clicked
$('form#submit').hide(function ()
{
$('div#errors').fadeIn(3000);
});
}
});
return false;
});
});
</script>
我想动议的fancybox出现在阿贾克斯成功。我应该怎么办呢?
I want to move that fancybox to appear on ajax success. How should I do that?
推荐答案
您可以手动调用的fancybox这个简单的功能
You can call a fancybox manually with this simple function
$.fancybox(
'<p>Content of the box in HTML</p>',
{
padding:15,
closeBtn:true
}
);
只是把它添加到成功的功能。
Just add it to the success function.
这篇关于显示器的jQuery的fancybox为阿贾克斯成功的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文