Jump to content
leonardo092004

ERRO Uncaught ReferenceError: load_page is not defined at HTMLAnchorElement.onclick (index.php:47)

Recommended Posts

Estou fazendo Carregamento página sem load com o Ajax.

porem no fim ele da o na de clicar ele me da esse o erro 

ERRO Uncaught ReferenceError: load_page is not defined     at HTMLAnchorElement.onclick (index.php:47)

 

abaixo segue minha index.php 

 

POR FAVOR ME AJUDEM!!!!


<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>Bootstrap, from Twitter</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">

    <!-- Le styles -->
    <link href="bootstrap/css/bootstrap.css" rel="stylesheet">
    <style>
      body {
        padding-top: 60px; /* 60px to make the container go all the way to the bottom of the topbar */
      }
    </style>
    <link href="bootstrap/css/bootstrap-responsive.css" rel="stylesheet">

    <!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
    <!--[if lt IE 9]>
      <script src="../assets/js/html5shiv.js"></script>
    <![endif]-->

    <!-- Fav and touch icons -->
    <link rel="apple-touch-icon-precomposed" sizes="144x144" href="../assets/ico/apple-touch-icon-144-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="../assets/ico/apple-touch-icon-114-precomposed.png">
      <link rel="apple-touch-icon-precomposed" sizes="72x72" href="../assets/ico/apple-touch-icon-72-precomposed.png">
                    <link rel="apple-touch-icon-precomposed" href="../assets/ico/apple-touch-icon-57-precomposed.png">
                                   <link rel="shortcut icon" href="../assets/ico/favicon.png">
  </head>

  <body>

    <div class="navbar navbar-inverse navbar-fixed-top">
      <div class="navbar-inner">
        <div class="container">
          <button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
          <a class="brand" href="#">CapXML</a>
          <div class="nav-collapse collapse">
            <ul class="nav">
                <li class="active"><a href="javascript:" onclick="load_page('home.php?id=5');">home</a></li>   
                <li><a href="javascript:" onclick="load_page('cliente.php?id=5');">cliente</a></li>
              <li><a href="javascript:" onclick="load_page('usuario.php?id=5');">usuario</a></li>
            </ul>
          </div><!--/.nav-collapse -->
        </div>
      </div>
    </div>

    <div class="container">

        <div id="pagina_retorno"></div>
                       
      <h1>home</h1>
            
    </div> <!-- /container -->

    <!-- Le javascript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    <script src="bootstrap/js/jquery-3.4.1.slim.min.js"></script>
    <script src="bootstrap/js/bootstrap.min.js"></script>
    <script src="bootstrap/js/bootstrap.js"></script>
    <script type ="text/javascript">
        
        function load_page (arquivo) {
            if (arquivo){
                $.ajax({
                    type:'GET',
                    data: arquivo,
                    url: arquivo,
                    sucesses: function (data){
                        $("#pagina_retorno").html(data);
                    }
                });
            }
            
        }

  </body>
</html>

Share this post


Link to post
Share on other sites

image.png.75095780d21bcf93687ba1240e881139.png

 

Agora aparece o erro acima quando rodo no site..

ele aponta a 1 primeira linha, mas a primeira linha <!DOCTYPE HTML>..

 

O ARQUIVO ESTA COMPLETO NÃO SEI O PODE SER..

<!doctype html>
<html lang="br">
  <head>
    <meta charset="utf-8">
    <title>Starter Template for Bootstrap</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">
    
    
    <link href="bootstrap/css/bootstrap.css" rel="stylesheet">
    <style>
        body {
            padding-top: 60px;
        }
    
    </style>
   
     <link href="bootstrap/css/bootstrap-responsive.css" rel="stylesheet">

       
    
  </head>

  <body>

    <div class="navbar navbar-inverse navbar-fixed-top">
      <div class="navbar-inner">
        <div class="container">
            <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            </a>
            <a class="brand" href="#">CapXml</a>
            <div class="nav-collapse collapse">
            <ul class="nav">
                 <li class="active"><a href="javascript::" onclick="load_page('home.php');">home</a></li>
                 <li><a href="javascrip::" onclick="load_page('usuario.php');">usuario</a></li>
                 <li><a href="javascrip::" onclick="load_page('cliente.php');">cliente</a></li>
            </ul>
           </div><!--/.nav-collapse -->
         </div>
       </div>
     </div>      
        
      <div class="container">
            <div id="pagina_retorno">
                <h1>home</h1>
            </div>
      </div>

      <script src="bootstrap/js/jquery.min.js"></script>
      <script src="bootstrap/js/bootstrap.min.js"></script>
      <script src="bootstrap/js/bootstrap.js"></script>
      <script type="text/javascript">
           function load_page(arquivo){
               if(arquivo){
                   $.ajax({
                       type:'GET',
                       data: arquivo,
                       url: arquivo,
                       success: function (data) {
                           $("#pagina_retono").html(data);
                       }
                   });
               }
           }
        
   </script>
  </body>
</html>

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×

Important Information

Ao usar o fórum, você concorda com nossos Terms of Use.