I have a form that submits with Ajax.
开发者_开发技巧I want to respond by opening a Fancybox Modal window from within a js.erb file.
How can I do this and have content loaded into the fancybox.
Thanks in advance.
<head>
<script src="jquery-1.4.4.min.js" type="text/javascript"></script>
<script type="text/javascript" src="fancybox/jquery.fancybox-1.3.4.pack.js"></script>
<link rel="stylesheet" type="text/css" href="fancybox/jquery.fancybox-1.3.4.css" />
<script type="text/javascript">
$(function () { //JQuery page onload
divtoshow = '<div style="height: 250px; width: 400px;">'
+ '<h2>Modal Fancybox</h2>'
+ 'This is my message'
+ '<br /><br /><input type="button" value="Close" onclick="javascript:$.fancybox.close();" />'
+ '</div>';
//Show fancybox
$.fancybox(
divtoshow,
{
'modal' : true
, 'height' : 250
, 'width' : 400
}
);
}); //JQuery page onload
</script>
</head>
精彩评论