I dont know if i was wrong or XMLHttpRequest is STUPID. My random quote machine just go to https://quotesondesign.com/api-v4-0/ to get 1 same JSON object everytime when i send request to the API
Here is my javascript code.
var text_receive = document.getElementById(“quote-text”);
var btn= document.getElementById(“more”);
btn.addEventListener('click',function(e){
var ourRequest = new XMLHttpRequest();
ourRequest.open('GET','http://quotesondesign.com/wp-json/posts?filter[orderby]=rand&filter[posts_per_page]=1',true);
ourRequest.onload = function(){
var Data = JSON.parse(ourRequest.responseText);
console.log(Data);
text_receive.insertAdjacentHTML("beforeend",Data[0].content);
}
//send request
ourRequest.send();
// num++;
// alert(num);
</code>
and here is the link to my project http://codepen.io/Fatherof10kids/pen/WpamJK.