0
I have the following Menu on my page Index.php
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="container-fluid">
<a class="navbar-brand" href="#">Lanchonete</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="#">Home</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
Vendas
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown">
<li><a class="dropdown-item" href="#">Local</a></li>
<li><a class="dropdown-item" href="#">Domicilio</a></li>
</ul>
</li>
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="#">Compras</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
Cadastros
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown">
<li><a class="dropdown-item Exibe-Lista" href="#" onclick="Load_Page('../D_PHP/CadastroProduto.php');">Produtos</a></li>
<li><a class="dropdown-item" onclick="Load_Page('../D_PHP/CadastroClientes.php');">Clientes</a></li>
<li><a class="dropdown-item" onclick="Load_Page('../D_PHP/CadastroFuncionario.php');">Funcionarios</a></li>
<li><a class="dropdown-item" onclick="Load_Page('../D_PHP/CadastroFabricante.php');">Fabricante</a></li>
<li><a class="dropdown-item" onclick="Load_Page('../D_PHP/CadastroContato.php');">Contatos</a></li>
<li><a class="dropdown-item" onclick="Load_Page('../D_PHP/CadastroEstadoVenda.php');">Estado de Venda</a></li>
</ul>
</li>
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="#">Anotacoes</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
Contas
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown">
<li><a class="dropdown-item" href="#">A Receber</a></li>
<li><a class="dropdown-item" href="#">A Pagar</a></li>
</ul>
</li>
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="#">Pesquisar</a>
</li>
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="#">Relatorios</a>
</li>
</ul>
</div>
</div>
</nav>
Corresponding to the page "Index.php" I have the file "Index.js" with the following function:
function Load_Page(fileList)
{
if (fileList)
{
$.ajax({
type: 'GET',
data: fileList,
url: fileList,
success: function (data) {
$("#Conteudo").html(data);
}
});
}
}
The AJAX function is called when the user clicks on the Menu buttons Cadastro
> Clientes
|| Produtos
|| Funcionários
|| Fabricante
|| Contatos
|| Estado de Venda
. However, when I click on these buttons for the page to be invoked by AJAX, the following error occurs:
Uncaught ReferenceError: Load_Page is not defined
at HTMLAnchorElement.onclick
I am unable to find the error once the code is correct, and the function that is called in the onclick
also. What would be the cause of this error?
Important you [Dit] your question and explain objectively and punctually the difficulty found, accompanied by a [mcve] of the problem and attempt to solve. To understand what kind of question serves the site and, consequently, avoid closures and negativities worth reading What is the Stack Overflow and the Stack Overflow Survival Guide (summarized) in Portuguese.
– Bacco