Last active
December 22, 2015 06:08
-
-
Save alcance/6428663 to your computer and use it in GitHub Desktop.
request ajax y guardar datos en server
This file contains 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
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