File tree Expand file tree Collapse file tree 2 files changed +11
-11
lines changed Expand file tree Collapse file tree 2 files changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -1184,13 +1184,7 @@ <h1 class="footer__title">Nipun</h1>
1184
1184
</ div >
1185
1185
</ footer >
1186
1186
</ main >
1187
- < script >
1188
- function cb ( response ) {
1189
- console . log ( response . value ) ;
1190
- document . getElementById ( 'visits' ) . innerText = response . value ;
1191
- }
1192
- </ script >
1193
- < script async src ="https://api.countapi.xyz/hit/nipunh.github.io/visits?callback=cb "> </ script >
1187
+ < script src ="./js/counter.js "> </ script >
1194
1188
< script type ="text/javascript " src ="https://cdn.jsdelivr.net/npm/@emailjs/browser@4/dist/email.min.js "> </ script >
1195
1189
< script src ="./js/main.js "> </ script >
1196
1190
</ body >
Original file line number Diff line number Diff line change 1
- function cb ( response ) {
2
- console . log ( response . value )
3
- document . getElementById ( 'visits' ) . innerText = response . value ;
4
- }
1
+ const countElement = document . getElementById ( 'count' ) ;
2
+
3
+ fetch ( 'https://api.countapi.xyz/hit/nipunh.github.io/nipunh' )
4
+ . then ( response => response . json ( ) )
5
+ . then ( data => {
6
+ countElement . innerText = data . value ;
7
+ } )
8
+ . catch ( error => {
9
+ console . error ( 'Error fetching the count:' , error ) ;
10
+ } ) ;
You can’t perform that action at this time.
0 commit comments