Created
February 8, 2009 02:19
-
-
Save gnuget/60144 to your computer and use it in GitHub Desktop.
Simple ajax call in jquery
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Amarramos a las anchors un evento | |
$(document).ready(function(){ | |
$("a").click(function(){ | |
alert("hola mundo!"); | |
}); | |
}); | |
//hacemos una llamada ajax | |
$.ajax({ | |
type: "POST", | |
url: "patito.php", | |
success: function(msg){ | |
//inyectamos lo que nos regreso la llamada en algún lugar: | |
$("#div").append(msg); | |
//regularmente tendríamos aquí que re-ligar los eventos si entre lo que nos regresa | |
//la llamada ajax vienen alguna etiqueta "a" por ejemplo: | |
$("a.llamada_ajax").click(function(){ | |
alert("hola mundo"); | |
}); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment