Grails 2.0问题渲染FancyBox

时间:2012-07-30 15:15:04

标签: grails fancybox grails-2.0 fancybox-2

使用Grails 2.0.4和FancyBox 2。

我正在尝试在grails框架中的模式或对话框弹出窗口中呈现html。目前我正在尝试使用FancyBox 2.但是我似乎无法渲染fancybox。这是我现在拥有的。

控制器:

class TestController {

def index() { }

def createResult() {
    render 'got here dude'
}

}

从gsp:

发挥作用
    <body>
    //attempts to use fancy box but fails 
    <a class="fb" href="${createLink(action: 'createResult', controller: 'test') }" >Click Here</a>
    //not fancy box, renders page only
    <a class="not" href="${createLink(action: 'createResult', controller: 'test') }" >Click Here2</a>
    <script type="text/javascript">
    $(document).ready(function() {
        $(".fb").fancybox();
    });
    </script>
</body>

点击顶部链接我最终收到以下错误: 未捕获错误:语法错误,无法识别的表达式:/ ModalTest / test / createResult

有没有人对如何使用grails工作有任何建议,或者有其他对话/模态解决方案可以使用控制器工作?

提前谢谢。

1 个答案:

答案 0 :(得分:0)

添加类 fancybox.ajax ,这应该可以,因为您正在尝试加载ajax内容:

<a class="fb fancybox.ajax" href="${createLink(action: 'createResult', controller: 'test') }" >Click Here</a>