Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <meta http-equiv="X-UA-Compatible" content="ie=edge">
- <title>POST y GET</title>
- </head>
- <body>
- <input type="text" name="nombre">
- <button>Enviar</button>
- <script src="js/jquery.js"></script>
- <script>
- $(document).ready(function(){
- $("button").click(function(){
- //ajax simplificado
- /*
- $.post('http://localhost/cursos-www/ejercicios-curso-html5/ejercicios-jquery/rest.php',
- {nombre:$("input[name='nombre']").val()},
- function(data){
- alert(data);
- });
- */
- $.get('https://jsonplaceholder.typicode.com/posts',function(data){
- console.log(data);
- });
- });
- });
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement