开发者

javascript problem with grails application on the server

开发者 https://www.devze.com 2023-03-15 10:48 出处:网络
i have grails application. i use javascript files with this project. (I use javascript for calender) problem:

i have grails application. i use javascript files with this project. (I use javascript for calender)

problem: this calender works fine on my pc, but when i put my project on the server this calender doesn't work.

What can i do to keep this calender works on the server.

Note: operating system of my Pc and af server is linus ubuntu.

<g:javascript library="application"/>
<script src="/tandium.com/js/jquery-1.4.2.min.js" type="text/javascript"></script>
<script src="/tandium.com/js/jquery-ui-1.8.4.custom.min.js" type="text/javascript"></script>
<script src="/tandium.com/js/jquery.ui.datetimepicker.js" type="text/javascript"></script>
<script  type="text/javascript" language="javascript1.2">

<script type="text/javascript">
        $(document).ready(function() {
            $('.datetime').datetimepicker({dateFormat: "yyyy-mm-dd HH:MM:ss"});
        });
</script>

This calender works when user click on a tex开发者_如何学JAVAtbox, calender appears, user then choose a date, to appear in the textbox


Right, now you have posted some code, I think I can see the issue..

You have hard-coded your context into your javascript links

<script src="/tandium.com/js/jquery-1.4.2.min.js" type="text/javascript"></script>
<script src="/tandium.com/js/jquery-ui-1.8.4.custom.min.js" type="text/javascript"></script>
<script src="/tandium.com/js/jquery.ui.datetimepicker.js" type="text/javascript"></script>

Can you try using the grails code to get a link like so:

<script src="${resource(dir:'js', file:'jquery-1.4.2.min.js')}" type="text/javascript"></script>
<script src="${resource(dir:'js', file:'jquery-ui-1.8.4.custom.min.js')}" type="text/javascript"></script>
<script src="${resource(dir:'js', file:'jquery.ui.datetimepicker.js')}" type="text/javascript"></script>

That should fix it... (you would have been getting 404 errors, and any javascript console would have shown you those files as missing)

Also, the line:

<script  type="text/javascript" language="javascript1.2">.2">

Has an extra .2"> on the end of it (but that might be a cut/paste error posting here)

0

精彩评论

暂无评论...
验证码 换一张
取 消