| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sample API call using RESTapi from the client computer
$(function() {
//this is your event listener
$('.randomQuote').on('click', function(e)
$.ajax({
method: 'get',
url:
red_vars.rest_url + 'wp/v2/posts?filter[orderby]=rand&filter[posts_per_page]=10'
}).done(function(data) {
console.log(data);
});
});
});
})(jQuery);
Create, read, update and delete method: 'get' translates to read data from the user's browser and evaluate that to query the databse for a new post
#document.ready function syntax. Used if you want to write jQuery code to handle an event listening (function($) {
} ) (jQuery);
#Learnings
##Functions used so far:
| Back | FazBrowse Home | New Git URL |