Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jquery-ui/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使web.py和jQuery UI协同工作?_Jquery_Jquery Ui_Web.py - Fatal编程技术网

如何使web.py和jQuery UI协同工作?

如何使web.py和jQuery UI协同工作?,jquery,jquery-ui,web.py,Jquery,Jquery Ui,Web.py,jQuery UI可以与web.py一起使用吗?使用jQuery和web.py,可以使用jQuery或$$触发事件(因为web.py使用$作为模板变量),但jQuery UI似乎不是这样 我从下面的代码中得到以下错误:jQuery(#dialog”)。dialog不是函数。相同的代码在web.py框架之外正确执行 <html> <head> <meta http-equiv="Content-Type" content="text/html; charset

jQuery UI可以与web.py一起使用吗?使用jQuery和web.py,可以使用jQuery或$$触发事件(因为web.py使用$作为模板变量),但jQuery UI似乎不是这样

我从下面的代码中得到以下错误:jQuery(#dialog”)。dialog不是函数。相同的代码在web.py框架之外正确执行

<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>jQuery UI Example Page</title>
    <script src="http://code.jquery.com/jquery-1.7.1.min.js" type="text/javascript"></script>
    <script src="/usr/local/pos/templates/jquery-ui-1.8.18.custom.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        jQuery(function(){

            // Dialog           
            jQuery('#dialog').dialog({
                autoOpen: false,
                width: 600,
                buttons: {
                    "Ok": function() { 
                        jQuery(this).dialog("close"); 
                    }, 
                    "Cancel": function() { 
                        jQuery(this).dialog("close"); 
                    } 
                }
            });

            // Dialog Link
            jQuery('#dialog_link').click(function(){
                jQuery('#dialog').dialog('open');
                return false;
            });             
        });

    </script>   
</head>
<body>
<h1>Hello</h1>  

    <h2>Dialog</h2>
    <a href="#" id="dialog_link">Open Dialog</a>

    <!-- ui-dialog -->
    <div id="dialog" title="Dialog Title">
        <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
    </div>
</body>
</html>

jQueryUI示例页面
jQuery(函数(){
//对话
jQuery(“#dialog”).dialog({
自动打开:错误,
宽度:600,
按钮:{
“Ok”:函数(){
jQuery(this.dialog)(“close”);
}, 
“取消”:函数(){
jQuery(this.dialog)(“close”);
} 
}
});
//对话框链接
jQuery(“#对话框_链接”)。单击(函数(){
jQuery('#dialog')。dialog('open');
返回false;
});             
});
你好
对话
知识产权是一种权利,是一种精英的权利,是劳动和财富的暂时性权利。但是,在最低限度上,我们需要一个实验室来进行日常工作


您可能没有正确加载jQuery UI

/usr/local/pos/templates/jquery-ui-1.8.18.custom.min.js
看起来它应该是一个http URL—您不想使用本地文件系统路径。(如果它是一个相对文件系统路径,请仔细检查它是否正确。)


确保您使用了正确的URL。

我知道这是一篇老文章,但我觉得这可能也有帮助。你说你找不到http来代替本地版本。Google在其CDN上托管了几个java脚本库。您可以在此处查看此信息-

只需单击所需的库。它们有jquery和jqueryui,它们正好包含您需要粘贴的内容


如果您想要jquery ui的CSS文件,您可以在这里找到这些文件的链接-(第一个/最佳答案)

谢谢您的建议,但是对于jquery ui,我还没有找到可以使用的http URL。该网站指向下载:。由于此代码在web.py框架之外正常工作,我相信库的加载是正确的。@Nora您的jQuery UI库副本在哪里?其他页面使用什么URL加载它?我的jQuery UI库位于/usr/local/pos/templates/jQuery-UI-1.8.18.custom.min.js中,我使用绝对路径来消除在web.py外部和框架内部执行的代码之间的任何差异。@Nora你能在Chrome或Firebug的“网络”中确认吗JS文件实际上正在加载的选项卡?我愿意赌一大杯啤酒,说这个文件有点古怪,而且它不会把啤酒装在我身上!非常感谢。我在web.py中错误地加载了静态文件。我需要把它放在一个单独的文件夹里-