Skip to content

Instantly share code, notes, and snippets.

@coderdiaz
Last active August 29, 2015 14:03
Show Gist options
  • Save coderdiaz/422362ee7b701c86dc4c to your computer and use it in GitHub Desktop.
Save coderdiaz/422362ee7b701c86dc4c to your computer and use it in GitHub Desktop.
$(document).ready(function(){
$('#getDatos').click(function(){
$.ajax({
url: 'consulta.php',
success: function(data){
$("p").remove();
console.log(data); //<=== Esta puede ser removida;
var datos = $.parseJSON(data);
console.log(datos); //<=== Esta puede ser removida;
$.each(datos, function(i, row) {
var fila = $('<tr/>');
$.each(row, function(name, value) {
$('<td/>', {
text: value
}).appendTo(fila);
});
fila.appendTo('#datos');
});
}
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment