Uncaught reference error lift ajax is not defined

后端 未结 2 1830
盖世英雄少女心
盖世英雄少女心 2021-01-16 08:17

I\'m trying to create a Lift chat server. I\'ve taken everything straight from the Lift book that is linked to from Lift\'s main website. Upon running it, I cannot submit my

相关标签:
2条回答
  • 2021-01-16 08:36

    In my case, I was missing following body part that automatically seems to source liftAjax.

    <body class="lift:content_id=main">
        <div id="main" class="lift:surround?with=default;at=content">
               ......
        </div>
    </body>
    

    But, in another case, sourcing jquery manually would work with JQuery module injected in Boot.scala.

    <script id="jquery" src="/classpath/jquery.js" type="text/javascript"></script>
    
    0 讨论(0)
  • 2021-01-16 08:51

    You don't need to manually include the liftAjax function, but you do need to include jquery manually. Lift will not automatically inject a reference to it since it doesn't know what version, minification level, or location you want to use. Try adding:

    <script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
    

    To the head section of your template.

    0 讨论(0)
提交回复
热议问题