Sunday 19 August 2018

error while getting reddits json with jquery ($.getJSON)

Dear people i have stumbled upon a big problem while making my nsfw hentai bot for discord. This is my code: if(command == "hentai"){ var redditjson = 'https://ift.tt/2L8hZjc'; var subreddit = 'monstergirl+hentai+hentai_gif+ahegao+rule34+hentaibondage'; var aRandomNum = Math.floor((Math.random() * 25) + 1); // A random number - range 25 console.log("HENTAI STEP -1. ACK ARANDOMNUM (" + aRandomNum + ")"); $.getJSON('https://ift.tt/2nRbuIA', function(data) { console.log("HENTAI STEP 0. COMPLETED $.GETJSON AND FUNCTION."); $.each(data.data.children, function(i,item){ console.log("HENTAI STEP 1."); if (i == aRandomNum) { console.log("HENTAI STEP 2. COMPLETED IF STATEMENT (COMPARE I WITH ARANDOMNUM) "); console.log(item.data.url); return; } }); }); } however, when I launch my command, the console only shows me HENTAI STEP -1 and I get the following error:Error: Cross origin null forbidden I am used to web development and have no experience at all with nodejs because i never use it, but I think this means something like they have a php http header for cross origin . Please prove me wrong. Thanks in advance, Sam

Submitted August 19, 2018 at 05:45PM by Sam0072

No comments:

Post a Comment