Created
July 15, 2017 17:01
-
-
Save filippo-quacquarelli/b0703c047cae67fce3be3aaa5933b53a to your computer and use it in GitHub Desktop.
Wp custom rest api tutorial
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
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