Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/308.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
Python JQuery CDN不工作,找不到localfile_Python_Jquery_Flask - Fatal编程技术网

Python JQuery CDN不工作,找不到localfile

Python JQuery CDN不工作,找不到localfile,python,jquery,flask,Python,Jquery,Flask,我试图用一些简单的jquery隐藏一个按钮。 我试图将jquery.js文件放在与html页面相同的文件夹中,但这会产生404错误,因为它正在服务器上查找jquery.js文件,而不是我的本地计算机 我原以为我会使用CDN,但这同样不起作用,在控制台中,我看不到对CDN的任何请求,就像我将其指定为本地文件一样 有人能给我指出正确的方向吗 <html> <body> <script src="jquery.js"></script>

我试图用一些简单的jquery隐藏一个按钮。 我试图将jquery.js文件放在与html页面相同的文件夹中,但这会产生404错误,因为它正在服务器上查找jquery.js文件,而不是我的本地计算机

我原以为我会使用CDN,但这同样不起作用,在控制台中,我看不到对CDN的任何请求,就像我将其指定为本地文件一样

有人能给我指出正确的方向吗

<html>
<body>
    <script src="jquery.js"></script>
    <script>
    $("#vlan_text").hide();
    </script>
<div class="content-section">
    <!-- ## form method must be POST for button click action-->
   <form method="POST" action="">
    <div class="input-group mb-3">
        <div class="input-group-prepend" id="test">
            <span class="input-group-text">Gi1/0/</span>
        </div>        
        <input type="text" class="form-control" id="port_in" name="port_input" aria-label="Port Number">
    </div>
    <input class="btn btn-info" type="submit" id="run_int" name="sh_run_int" value="Show interface configuration">
    <div class="well">
      <!-- ## the <pre> tags specify preformatted text-->
      <pre> {{ show_run_int }} </pre>
    </div>
    <div class="input-group mb-3" id="vlan_div">
        <input type="text" class="form-control" id="vlan_text" name="vlan_input" aria-label="VLAN">
    </div>
    </div>
   </form>
<body>
</html>



$(“#vlan_text”).hide();
Gi1/0/
{{show_run_int}

尝试下面的代码,确保HTML和JQuery文件位于同一目录中


Gi1/0/
{{show_run_int}
$(“#vlan_text”).hide();
  • 确保标记文件(HTML)和JQuery位于同一目录中,或者具有脚本的正确路径

  • 你为什么不关闭身体标签(也许问题是因为他)


  • 使用文件public_html/something/something/jquery.js Update的完整路径进行尝试:您编写的脚本此时将触发,因此您应该将其包装在jquery(document).ready(function(){//script})中;原因是DOM在脚本触发时还没有准备好,谢谢您的帮助!我添加了正确的路径并关闭了body标签。现在它工作了!再次感谢。
    <html>
    <body>
    <div class="content-section">
        <!-- ## form method must be POST for button click action-->
       <form method="POST" action="">
        <div class="input-group mb-3">
            <div class="input-group-prepend" id="test">
                <span class="input-group-text">Gi1/0/</span>
            </div>        
            <input type="text" class="form-control" id="port_in" name="port_input" aria-label="Port Number">
        </div>
        <input class="btn btn-info" type="submit" id="run_int" name="sh_run_int" value="Show interface configuration">
        <div class="well">
          <!-- ## the <pre> tags specify preformatted text-->
          <pre> {{ show_run_int }} </pre>
        </div>
        <div class="input-group mb-3" id="vlan_div">
            <input type="text" class="form-control" id="vlan_text" name="vlan_input" aria-label="VLAN">
        </div>
        </div>
       </form>
        <script src="jquery.js"></script>
        <script>
        $("#vlan_text").hide();
        </script>
    <body>
    </html>