- AJAX = Asynchronous JavaScript + XML (although JSON is used more these days)
- No refresh
- Less bandwidth
- Split the work between the client and server
- Offload some of the work to the user's computer
$.ajax({
url: "https://turing-birdie.herokuapp.com/api/v1/posts",
method: "GET",
dataType: "JSON",
success: function(posts){ // <- the 'posts' here is kind of like a block parameter in ruby |posts|
}
})
$.ajax({
url: "https://turing-birdie.herokuapp.com/api/v1/posts.json",
method: "GET",
dataType: "JSON",
success: function(posts){
console.table(posts)
}
})