Skip to content

Commit

Permalink
BhagavadGitaApi endpoint fix
Browse files Browse the repository at this point in the history
  • Loading branch information
PtPrashantTripathi authored Jul 21, 2023
1 parent bd7f5a0 commit 6b85aef
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions script.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
const slokcount = [
47, 72, 43, 42, 29, 47, 30, 28, 34, 42, 55, 20, 35, 27, 20, 24, 28, 78,
];
const chapter = Math.floor(Math.random() * 17) + 1;
const slok = Math.floor(Math.random() * slokcount[chapter - 1]) + 1;
const gitaslok_url = `https://bhagavadgitaapi.in/slok/${chapter}/${slok}/`;

fetch(gitaslok_url)
.then((data) => data.json())
.then((sData) => {
const slokT = sData.slok;

const siva = sData.siva.et;

const sp = document.getElementById("sp");

const mp = document.getElementById("mp");

sp.innerHTML = slokT;

mp.innerHTML = siva;
});
const slokcount = [
47, 72, 43, 42, 29, 47, 30, 28, 34, 42, 55, 20, 35, 27, 20, 24, 28, 78,
];
const chapter = Math.floor(Math.random() * 17) + 1;
const slok = Math.floor(Math.random() * slokcount[chapter - 1]) + 1;
const gitaslok_url = `https://bhagavadgitaapi.in/slok/${chapter}/${slok}/`;

fetch(gitaslok_url)
.then((data) => data.json())
.then((sData) => {
const slokT = sData.slok;

const siva = sData.siva.et;

const sp = document.getElementById("sp");

const mp = document.getElementById("mp");

sp.innerHTML = slokT;

mp.innerHTML = siva;
});

0 comments on commit 6b85aef

Please sign in to comment.