From 1ce13b288aa390a721b2da1dc45fb13879f2e9ae Mon Sep 17 00:00:00 2001 From: Programador Novato Date: Sun, 21 Jul 2019 04:10:50 -0500 Subject: [PATCH] =?UTF-8?q?09.-=20Ajax=20con=20Jquery=F0=9F=8C=87=20=20de?= =?UTF-8?q?=200=20a=20100=20[=20Ajax=20envio=20de=20datos=20via=20post=20]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Video: https://youtu.be/NMsDDVnNwC8 --- convertir.php | 12 ++++-------- index.html | 38 ++++++++++++++++++++------------------ javascript.js | 18 +++++++++--------- 3 files changed, 33 insertions(+), 35 deletions(-) diff --git a/convertir.php b/convertir.php index 4f4e932..42441a2 100644 --- a/convertir.php +++ b/convertir.php @@ -1,12 +1,8 @@ Puesto:".$_POST['puesto']; } + + ?> \ No newline at end of file diff --git a/index.html b/index.html index 5e9cd37..3b58280 100644 --- a/index.html +++ b/index.html @@ -1,33 +1,35 @@ + - + ajax + - -
- -
- - -
- +
+
+
+ + + + + +
+ +
- + + \ No newline at end of file diff --git a/javascript.js b/javascript.js index 6a03954..1dd59e6 100644 --- a/javascript.js +++ b/javascript.js @@ -1,13 +1,13 @@ $(document).ready(function () { - $('#convertir').click(function (e) { + $('form').submit(function (e) { e.preventDefault(); - let opracion=$('#opracion').val(); - let texto=$('#texto').val(); - $.get("http://localhost/ajax/convertir.php", - {'operacion':opracion,'texto':texto}, - function(data){ - console.log(data); - $('#listaEmpleados').html(data); - }); + let nombre=$('#nombre').val(); + let puesto=$('#puesto').val(); + $.post("http://localhost/ajax/convertir.php", + {'nombre':nombre,'puesto':puesto}, + function (data, textStatus, jqXHR) { + $('#res').html(data); + } + ); }); }); \ No newline at end of file