Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <head>
- <title>Pede Aqui</title>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.6/css/materialize.min.css">
- <script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.6/js/materialize.min.js"></script>
- </head>
- <body>
- <script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
- <script type="text/javascript">
- $(document).ready(function () {
- lista();
- $("input[name=enviar]").click(function () {
- var nome = $("input[name=nome]").val();
- var descri = $("input[name=descri]").val();
- envia(nome, descri);
- lista();
- });
- $("input[name=excluir]").click(function () {
- var nome = $("input[name=excluir]").val();
- exclui(nome);
- lista();
- });
- });
- function lista() {
- $.ajax({
- url: 'listaclasse.php',
- success: function (data) {
- $(".lista").html(data);
- }
- });
- }
- function exclui(nome) {
- info = {"nNome": nome};
- $.ajax({
- type: 'post',
- url: 'excluiclasse.php',
- data: info,
- }).done(function (data) {
- $(".resposta h3").text(data);
- console.log("chegou aqui");
- });
- }
- function envia(nome, descri) {
- info = {"nNome": nome, "nDescri": descri};
- $.ajax({
- type: 'post',
- url: 'cadastraClasse.php',
- data: info,
- }).done(function (data) {
- $(".resposta h3").text(data);
- });
- }
- </script>
- <form id="formulario">
- <div class="container">
- <label>Classe: <input type="text" name="nome" placeholder="Classe"/></label>
- <label>Descrição curta: <input type="text" name="descri" placeholder="Descrição curta"/></label>
- <input type="button" name="enviar" value="Enviar" placeholder="Enviar"/>
- <input type="button" name="listar" value="Listar" onclick="lista()" placeholder="Lista"/>
- </div>
- </form>
- <div class="resposta">
- <h3></h3>
- </div>
- <div class="lista">
- </div>
- </body>
Add Comment
Please, Sign In to add comment