Позвольте мне показать вам всех, я помещаю этот код в файл, называемый consultas.php
CONSULTAS.PHP
Этот файл показывает таблицу с данными в конце столбца с именем folio id="'.$row["folio"].'"
Когда я нажал туда, это показывает мне и к VISTAPREVIA.PHP для получения дополнительных данных об этом фолио, но в пейджинге # 1 он работает очень хорошо, и теперь, когда я собираюсь пейджинговать # 2, я снова щелкнул и не работал, потому что ничего мне не показывал, ошибка говорит мне: Uncaught ReferenceError: $ is not defined
<script type="text/javascript"> $(document).ready(function() { var table = $('#registros').DataTable({ "paging": true }); //new $.fn.dataTable.AutoFill( table ); $('.back').on("click", function(event) { event.preventDefault(); location.reload(); }); $('.modificar').on("click", function(event) { event.preventDefault(); //Cargamos el contenido del enlace var f = $(this).attr('id'); $('#mainContainer').load(this.href, {folio: f}, function(){ }); }); $('.vistaprevia').on("click", function(event) { event.preventDefault(); //Cargamos el contenido del enlace var f = $(this).attr('id'); $('#mainContainer').load(this.href, {folio: f}, function(){ }); }); $('.detalle').on("click", function(event) { event.preventDefault(); var f = $(this).attr('id'); $('<div></div>').load(this.href, {folio: f}).modal(); }); }); </script> <a href="#" class="back">REGRESAR ATRÁS</a> <h1 class="titPer">CONSULTA DE LA TABLA</h1> <div class="tabla"> <table id="registros" class="display" cellspacing="0"> <thead> <tr> <th>Folio</th> <th>Estatus</th> <th>Punto de Venta</th> <th>Usuario</th> <th>Acciones</th> </tr> </thead> <tbody> <?php while ($row = mysql_fetch_array($consulta)) { ?> <tr> <td><?=$row['folio']?></td> <td><?=$row['estatus']?></td> <td><?=$row['punto_venta']?></td> <td><?=$row['usuario']?></td> <td> <?php if($_SESSION['permisos'] == 'VENDEDOR' || $_SESSION['permisos'] == 'JEFESUC' || $_SESSION['permisos'] == 'EMBARQUES'){ echo ' <center> <a class="modificar icon-pencil" href="includes/vistaPrevia.php" id="'.$row["folio"].'"></a> | <a class="detalle icon-eye-plus" href="includes/lightbox.php" id="'.$row["folio"].'"></a> </center> '; }else{ echo' <center> <a class="vistaprevia icon-eye-plus" href="includes/vistaPrevia.php" id="'.$row["folio"].'"></a> </center> '; } ?> </td> </tr> <?php } ?> </tbody> </table> </div>
VISTAPREVIA.PHP
<?php session_start(); ?> <head> <link href='http://fonts.googleapis.com/css?family=PT+Sans+Narrow' rel='stylesheet' type='text/css'> </head> <a href="includes/consultas.php" class="back">REGRESAR ATRÁS</a> <h1 class="titPer">ACTUALIZACIÓN DE DATOS</h1> <!-- <form action="includes/"></form> --> <?php if($_SESSION['permisos'] == 'CALIDAD'){ include('upRegCal.php'); } ?> <form action="includes/edit.php" enctype="multipart/form-data" id="formAct" method="POST" name="enviarForm"> <?php if($_SESSION['permisos'] == 'VENDEDOR' || $_SESSION['permisos'] == 'JEFESUC' || $_SESSION['permisos'] == 'EMBARQUES'){ include('upRegUser.php'); } if($_SESSION['permisos'] == 'ADMINISTRADOR'){ //include('upRegCal.php'); echo "Hola Administrador"; } ?> </form>
в<?php session_start(); ?> <head> <link href='http://fonts.googleapis.com/css?family=PT+Sans+Narrow' rel='stylesheet' type='text/css'> </head> <a href="includes/consultas.php" class="back">REGRESAR ATRÁS</a> <h1 class="titPer">ACTUALIZACIÓN DE DATOS</h1> <!-- <form action="includes/"></form> --> <?php if($_SESSION['permisos'] == 'CALIDAD'){ include('upRegCal.php'); } ?> <form action="includes/edit.php" enctype="multipart/form-data" id="formAct" method="POST" name="enviarForm"> <?php if($_SESSION['permisos'] == 'VENDEDOR' || $_SESSION['permisos'] == 'JEFESUC' || $_SESSION['permisos'] == 'EMBARQUES'){ include('upRegUser.php'); } if($_SESSION['permisos'] == 'ADMINISTRADOR'){ //include('upRegCal.php'); echo "Hola Administrador"; } ?> </form>
в<?php session_start(); ?> <head> <link href='http://fonts.googleapis.com/css?family=PT+Sans+Narrow' rel='stylesheet' type='text/css'> </head> <a href="includes/consultas.php" class="back">REGRESAR ATRÁS</a> <h1 class="titPer">ACTUALIZACIÓN DE DATOS</h1> <!-- <form action="includes/"></form> --> <?php if($_SESSION['permisos'] == 'CALIDAD'){ include('upRegCal.php'); } ?> <form action="includes/edit.php" enctype="multipart/form-data" id="formAct" method="POST" name="enviarForm"> <?php if($_SESSION['permisos'] == 'VENDEDOR' || $_SESSION['permisos'] == 'JEFESUC' || $_SESSION['permisos'] == 'EMBARQUES'){ include('upRegUser.php'); } if($_SESSION['permisos'] == 'ADMINISTRADOR'){ //include('upRegCal.php'); echo "Hola Administrador"; } ?> </form>
последний
index.php
я должен заверить эту часть, потому что я помещаю правильные сценарии Jquery, но я не знаю, почему и я не мог найти проблему, и да, я использую скрипты Datables
<?php session_start(); ?> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html" charset="UTF-8"/> <title>Bienvenido</title> <script src="js/jquery-1.11.2.js"></script> <script src="js/funciones.js"></script> <script src="libs/datatables/media/js/jquery.dataTables.js"></script> <script src="libs/datatables/extensions/AutoFill/js/dataTables.autoFill.js"></script> <script type='text/javascript' src='js/jquery.simplemodal.js'></script> <script type='text/javascript' src='js/basic.js'></script> <link href='http://fonts.googleapis.com/css?family=Open+Sans:300italic,300,400,600,700' rel='stylesheet' type='text/css'> <link rel="stylesheet" href="css/normalize.css" type="text/css"/> <link rel="stylesheet" href="css/estilos.css" type="text/css"/> <link rel="stylesheet" href="css/estilosForm.css" type="text/css"/> <link type='text/css' href='css/basic.css' rel='stylesheet' media='screen' /> <link rel="stylesheet" href="libs/datatables/media/css/jquery.dataTables.css" type="text/css"/> <link rel="stylesheet" href="libs/datatables/extensions/AutoFill/css/dataTables.autoFill.css" type="text/css"/> </head> <body> <div class="fondoHeader"></div> <header class="shadow"> <nav> <?php if(isset($_SESSION['usuario'])) include('includes/btnSiSession.php'); else include('includes/btnNoSession.php'); ?> </nav> </header> <div id='mainContainer'> <?php include('includes/bienvenido.php'); if(isset($_SESSION['usuario'])){ echo "<script language='JavaScript'>"; // echo "document.getElementById('login').style.display='none'"; echo "document.getElementById('login').style.visibility='hidden'"; echo "</script>"; } else{ echo "<script language='JavaScript'>"; // echo "document.getElementById('login').style.display='block'"; echo "document.getElementById('login').style.visibility='visible'"; echo "</script>"; } ?> </div> <div class="clear"></div> <footer> <?php include('includes/footer.php'); ?> </footer> </body> </html>
в<?php session_start(); ?> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html" charset="UTF-8"/> <title>Bienvenido</title> <script src="js/jquery-1.11.2.js"></script> <script src="js/funciones.js"></script> <script src="libs/datatables/media/js/jquery.dataTables.js"></script> <script src="libs/datatables/extensions/AutoFill/js/dataTables.autoFill.js"></script> <script type='text/javascript' src='js/jquery.simplemodal.js'></script> <script type='text/javascript' src='js/basic.js'></script> <link href='http://fonts.googleapis.com/css?family=Open+Sans:300italic,300,400,600,700' rel='stylesheet' type='text/css'> <link rel="stylesheet" href="css/normalize.css" type="text/css"/> <link rel="stylesheet" href="css/estilos.css" type="text/css"/> <link rel="stylesheet" href="css/estilosForm.css" type="text/css"/> <link type='text/css' href='css/basic.css' rel='stylesheet' media='screen' /> <link rel="stylesheet" href="libs/datatables/media/css/jquery.dataTables.css" type="text/css"/> <link rel="stylesheet" href="libs/datatables/extensions/AutoFill/css/dataTables.autoFill.css" type="text/css"/> </head> <body> <div class="fondoHeader"></div> <header class="shadow"> <nav> <?php if(isset($_SESSION['usuario'])) include('includes/btnSiSession.php'); else include('includes/btnNoSession.php'); ?> </nav> </header> <div id='mainContainer'> <?php include('includes/bienvenido.php'); if(isset($_SESSION['usuario'])){ echo "<script language='JavaScript'>"; // echo "document.getElementById('login').style.display='none'"; echo "document.getElementById('login').style.visibility='hidden'"; echo "</script>"; } else{ echo "<script language='JavaScript'>"; // echo "document.getElementById('login').style.display='block'"; echo "document.getElementById('login').style.visibility='visible'"; echo "</script>"; } ?> </div> <div class="clear"></div> <footer> <?php include('includes/footer.php'); ?> </footer> </body> </html>
в<?php session_start(); ?> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html" charset="UTF-8"/> <title>Bienvenido</title> <script src="js/jquery-1.11.2.js"></script> <script src="js/funciones.js"></script> <script src="libs/datatables/media/js/jquery.dataTables.js"></script> <script src="libs/datatables/extensions/AutoFill/js/dataTables.autoFill.js"></script> <script type='text/javascript' src='js/jquery.simplemodal.js'></script> <script type='text/javascript' src='js/basic.js'></script> <link href='http://fonts.googleapis.com/css?family=Open+Sans:300italic,300,400,600,700' rel='stylesheet' type='text/css'> <link rel="stylesheet" href="css/normalize.css" type="text/css"/> <link rel="stylesheet" href="css/estilos.css" type="text/css"/> <link rel="stylesheet" href="css/estilosForm.css" type="text/css"/> <link type='text/css' href='css/basic.css' rel='stylesheet' media='screen' /> <link rel="stylesheet" href="libs/datatables/media/css/jquery.dataTables.css" type="text/css"/> <link rel="stylesheet" href="libs/datatables/extensions/AutoFill/css/dataTables.autoFill.css" type="text/css"/> </head> <body> <div class="fondoHeader"></div> <header class="shadow"> <nav> <?php if(isset($_SESSION['usuario'])) include('includes/btnSiSession.php'); else include('includes/btnNoSession.php'); ?> </nav> </header> <div id='mainContainer'> <?php include('includes/bienvenido.php'); if(isset($_SESSION['usuario'])){ echo "<script language='JavaScript'>"; // echo "document.getElementById('login').style.display='none'"; echo "document.getElementById('login').style.visibility='hidden'"; echo "</script>"; } else{ echo "<script language='JavaScript'>"; // echo "document.getElementById('login').style.display='block'"; echo "document.getElementById('login').style.visibility='visible'"; echo "</script>"; } ?> </div> <div class="clear"></div> <footer> <?php include('includes/footer.php'); ?> </footer> </body> </html>
в<?php session_start(); ?> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html" charset="UTF-8"/> <title>Bienvenido</title> <script src="js/jquery-1.11.2.js"></script> <script src="js/funciones.js"></script> <script src="libs/datatables/media/js/jquery.dataTables.js"></script> <script src="libs/datatables/extensions/AutoFill/js/dataTables.autoFill.js"></script> <script type='text/javascript' src='js/jquery.simplemodal.js'></script> <script type='text/javascript' src='js/basic.js'></script> <link href='http://fonts.googleapis.com/css?family=Open+Sans:300italic,300,400,600,700' rel='stylesheet' type='text/css'> <link rel="stylesheet" href="css/normalize.css" type="text/css"/> <link rel="stylesheet" href="css/estilos.css" type="text/css"/> <link rel="stylesheet" href="css/estilosForm.css" type="text/css"/> <link type='text/css' href='css/basic.css' rel='stylesheet' media='screen' /> <link rel="stylesheet" href="libs/datatables/media/css/jquery.dataTables.css" type="text/css"/> <link rel="stylesheet" href="libs/datatables/extensions/AutoFill/css/dataTables.autoFill.css" type="text/css"/> </head> <body> <div class="fondoHeader"></div> <header class="shadow"> <nav> <?php if(isset($_SESSION['usuario'])) include('includes/btnSiSession.php'); else include('includes/btnNoSession.php'); ?> </nav> </header> <div id='mainContainer'> <?php include('includes/bienvenido.php'); if(isset($_SESSION['usuario'])){ echo "<script language='JavaScript'>"; // echo "document.getElementById('login').style.display='none'"; echo "document.getElementById('login').style.visibility='hidden'"; echo "</script>"; } else{ echo "<script language='JavaScript'>"; // echo "document.getElementById('login').style.display='block'"; echo "document.getElementById('login').style.visibility='visible'"; echo "</script>"; } ?> </div> <div class="clear"></div> <footer> <?php include('includes/footer.php'); ?> </footer> </body> </html>
в<?php session_start(); ?> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html" charset="UTF-8"/> <title>Bienvenido</title> <script src="js/jquery-1.11.2.js"></script> <script src="js/funciones.js"></script> <script src="libs/datatables/media/js/jquery.dataTables.js"></script> <script src="libs/datatables/extensions/AutoFill/js/dataTables.autoFill.js"></script> <script type='text/javascript' src='js/jquery.simplemodal.js'></script> <script type='text/javascript' src='js/basic.js'></script> <link href='http://fonts.googleapis.com/css?family=Open+Sans:300italic,300,400,600,700' rel='stylesheet' type='text/css'> <link rel="stylesheet" href="css/normalize.css" type="text/css"/> <link rel="stylesheet" href="css/estilos.css" type="text/css"/> <link rel="stylesheet" href="css/estilosForm.css" type="text/css"/> <link type='text/css' href='css/basic.css' rel='stylesheet' media='screen' /> <link rel="stylesheet" href="libs/datatables/media/css/jquery.dataTables.css" type="text/css"/> <link rel="stylesheet" href="libs/datatables/extensions/AutoFill/css/dataTables.autoFill.css" type="text/css"/> </head> <body> <div class="fondoHeader"></div> <header class="shadow"> <nav> <?php if(isset($_SESSION['usuario'])) include('includes/btnSiSession.php'); else include('includes/btnNoSession.php'); ?> </nav> </header> <div id='mainContainer'> <?php include('includes/bienvenido.php'); if(isset($_SESSION['usuario'])){ echo "<script language='JavaScript'>"; // echo "document.getElementById('login').style.display='none'"; echo "document.getElementById('login').style.visibility='hidden'"; echo "</script>"; } else{ echo "<script language='JavaScript'>"; // echo "document.getElementById('login').style.display='block'"; echo "document.getElementById('login').style.visibility='visible'"; echo "</script>"; } ?> </div> <div class="clear"></div> <footer> <?php include('includes/footer.php'); ?> </footer> </body> </html>
UPDATE я ставлю этот код jQuery CDN script
<script src="ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function() { var table = $('#registros').DataTable({ "paging": true }); //new $.fn.dataTable.AutoFill( table ); $('.back').on("click", function(event) { event.preventDefault(); location.reload(); }); $('.modificar').on("click", function(event) { event.preventDefault(); //Cargamos el contenido del enlace var f = $(this).attr('id'); $('#mainContainer').load(this.href, {folio: f}, function(){ }); }); $('.vistaprevia').on("click", function(event) { event.preventDefault(); //Cargamos el contenido del enlace var f = $(this).attr('id'); $('#mainContainer').load(this.href, {folio: f}, function(){ }); }); $('.detalle').on("click", function(event) { event.preventDefault(); var f = $(this).attr('id'); $('<div></div>').load(this.href, {folio: f}).modal(); }); }); </script>