I have the following code:
function firstQuote(){
jQuery.ajax({
url: "https://quotesondesign.com/wp-json/posts?filter[orderby]=rand&filter[posts_per_page]=1&_jsonp=mycallback",
type: 'GET',
dataType: "jsonp",
});
function mycallback(json){
document.getElementById('quote').innerHTML = json[0].content;
}
};
window.onload = firstQuote;
It is a simple function, but it is not being executed. If I take the code outside of the function it works perfectly. I'm stuck at it for some time now. Please, could someone help me?