Skip to content

Instantly share code, notes, and snippets.

@alcance
Last active December 22, 2015 06:08
Show Gist options
  • Save alcance/6428663 to your computer and use it in GitHub Desktop.
Save alcance/6428663 to your computer and use it in GitHub Desktop.
request ajax y guardar datos en server
REQUEST AL SERVIDOR CON AJAX
// ==> public/js/main.js
$(document).on("ready" function(){
var xhr = $.get('/articles/all');
xhr.done(function(data){
console.log(data);
//por cada data que llega
data.forEach(function(articles){
//agrega a la colección cada elemento
window.collections.articles.add(articles);
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment