File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change 5
5
< meta charset ="UTF-8 ">
6
6
< meta http-equiv ="X-UA-Compatible " content ="IE=edge ">
7
7
< meta name ="viewport " content ="width=device-width, initial-scale=1.0 ">
8
+ < link rel ="shortcut icon " href ="https://cdn-icons-png.flaticon.com/512/4329/4329416.png " type ="image/x-icon ">
8
9
<!-- <link rel="stylesheet" href="./styles/style.css"> -->
9
10
<!-- <link rel="stylesheet" href="./styles/bootstrap.min.css"> -->
10
11
Original file line number Diff line number Diff line change @@ -40,8 +40,7 @@ form.addEventListener('submit', event => {
40
40
const sloka = document . querySelector ( '#sloka' ) . value ;
41
41
const url = `https://bhagavadgitaapi.in/slok/${ chapter } /${ sloka } ` ;
42
42
43
-
44
- //tried code
43
+
45
44
// Check if data is already in local storage
46
45
const storedData = localStorage . getItem ( `gita${ chapter } -${ sloka } ` ) ;
47
46
if ( storedData ) {
@@ -58,7 +57,15 @@ form.addEventListener('submit', event => {
58
57
` ;
59
58
} else {
60
59
// Data is not in local storage, make API request
61
- fetch ( url )
60
+ var headers = { } ;
61
+ fetch ( url ,
62
+ {
63
+ method : "GET" ,
64
+ mode : 'cors' ,
65
+ headers : {
66
+ 'Access-Control-Allow-Origin' :'*'
67
+ }
68
+ } )
62
69
. then ( response => response . json ( ) )
63
70
. then ( data => {
64
71
// Store data in local storage
You can’t perform that action at this time.
0 commit comments