Skip to content

Instantly share code, notes, and snippets.

@filippo-quacquarelli
Created July 15, 2017 17:01
Show Gist options
  • Save filippo-quacquarelli/b0703c047cae67fce3be3aaa5933b53a to your computer and use it in GitHub Desktop.
Save filippo-quacquarelli/b0703c047cae67fce3be3aaa5933b53a to your computer and use it in GitHub Desktop.
Wp custom rest api tutorial
var request = new XMLHttpRequest();
request.open('GET', 'http://www.mywordpressurl.com/wp-json/test/v1/posts/', true);
request.onload = function() {
// se la richiesta ha successo
if (request.status >= 200 && request.status < 400) {
var data = JSON.parse(request.responseText);
console.log(data);
}
};
request.send();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment