Ajax jQuery加载内容

时间:2019-07-11 22:38:47

标签: ajax

问题jQuery ajax加载内容时没有使用下拉项刷新

我正在为Linux创建一个Web面板,但是我想加载jQuery ajax,我看了一些教程,但他们没有提到nav dropdown-menu 有人可以帮忙吗?

脚本代码

$(document).ready(function(){
        // Set trigger and container variables
        var trigger = $('#nav ul li a '),
            container = $('#content');

        // Fire on click
        trigger.on('click', function(){
          // Set $this for re-use. Set target from data attribute
          var $this = $(this),
            target = $this.data('target');       

          // Load target page into container
          container.load(target + '".php"');

          // Stop normal link behavior
          return false;
        });
      });

HTML代码

<nav id="nav" class="navbar navbar-expand-sm bg-dark navbar-dark fixed-top" >

<a class="navbar-brand" href="#"><img class="brand" src="img/full-logo.png" alt="Aser" ></a>

  <!-- Links -->
  <ul class="navbar-nav">
     <li class="nav-item">
      <a class="nav-link" href="index.php"><span class="glyphicon glyphicon-home"></span>DASHBOARD</a>
 <li class="nav-item dropdown">
      <a class="nav-link dropdown-toggle" href="#" id="navbardrop" data-target="dhcp">
        REDE
      </a>
      <div id="sub-a" class="dropdown-menu">
        <a class="dropdown-item" href="#" data-target="exibe_if">Listar configurações de interfaces</a>
        <a class="dropdown-item" href="altera_if.php">Alterar configurações de interfaces</a>
      </div>
    </li>
 <li class="nav-item dropdown">
      <a class="nav-link dropdown-toggle" href="#" id="navbardrop" data-toggle="dropdown">
        ROTAS 
      </a>
      <div class="dropdown-menu">
        <a class="dropdown-item" href="lista_route.php">Listar rotas</a>
        <a class="dropdown-item" href="add_rota.php">Adicionar rotas</a>
        <a class="dropdown-item" href="altera_rota.php">Alterar rotas</a>
      </div>
    </li>
    <li class="nav-item">

      <a class="nav-link" href="#">FIREWALL</a>
</li>

 <li class="nav-item dropdown">
      <a class="nav-link dropdown-toggle" href="#" id="navbardrop" data-toggle="dropdown">
        PROXY 
      </a>
      <div class="dropdown-menu">
        <a class="dropdown-item" href="squid_log.php">Logs de acesso</a>
        <a class="dropdown-item" href="squid.php">Iniciar/Parar</a>
        <a class="dropdown-item" href="squid_test.php">Testar sites</a>
      </div>
    </li>
 <li class="nav-item dropdown">
      <a class="nav-link dropdown-toggle" href="#" id="navbardrop" data-toggle="dropdown">
        FERRAMENTAS 
      </a>
      <div class="dropdown-menu">
        <a class="dropdown-item" href="ping_test.php">Ping</a>
        <a class="dropdown-item" href="ping_tracert.php">Traceroute</a>
        <a class="dropdown-item" href="meuip.php">Meu ip</a>
        <a class="dropdown-item" href="#">Mtr</a>
        <a class="dropdown-item" href="#">Novas nics</a>
        <a class="dropdown-item" href="#">fping</a>
      </div>
    </li>


    <!-- Dropdown -->
    <li class="nav-item dropdown">
      <a class="nav-link dropdown-toggle" href="#" id="navbardrop" data-toggle="dropdown">
        DHCP 
      </a>
      <div class="dropdown-menu">
        <a class="dropdown-item" href="dhcp.php">Inserir entrada estática</a>
        <a class="dropdown-item" href="dhcp_alterar.php">Alterar entrada estática</a>
        <a class="dropdown-item" href="dhcp_remover.php">Remover entrada estática</a>
      </div>
    </li>
    <li class="nav-item">
     <a class="nav-link">      |  </a>
    </li>

    <li class="nav-item dropdown">
      <a class="nav-link dropdown-toggle" id="navbardrop" data-toggle="dropdown" href="#">

       Usuário: <?php echo htmlspecialchars($_SESSION["username"]); ?>
      </a>
      <div class="dropdown-menu">
        <a class="dropdown-item" href="logout.php">Logout</a>
      </div>
    </li>

  </ul>
</nav



  <div id="content">

    </div>

当我选择菜单时,它停止并且不显示下拉菜单,并且不加载div内容

0 个答案:

没有答案