Advertisement
Guest User

Untitled

a guest
Jul 16th, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. <form method="GET" action="/popup-teste" id="ID_DO_FORMULARIO">
  2. <button type="submit>OK!</button>
  3. <input name="teste" id="input1">
  4. </form>
  5.  
  6. <script language="JavaScript">
  7. $(document).ready(function() {
  8. $('#ID_DO_FORMULARIO').submit(function() { // pega o evento do form submit
  9. $.ajax({ // create an AJAX call...
  10. data: $(this).serialize(), // pega os dados do form
  11. type: $(this).attr('method'), // GET ou POST
  12. url: $(this).attr('action'), // pega a url no form action
  13. success: function(response) { // quando bem sucedido
  14. $('#DIV_PARA_ATUALIZAR').html(response); // atualiza o DIV
  15. }
  16. });
  17. return false;
  18. });
  19. });
  20. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement