Skip to content

Commit

Permalink
Replacing Jquery with Fetch in main.js(#114)
Browse files Browse the repository at this point in the history
  • Loading branch information
aucodes authored Oct 1, 2020
1 parent 590ce1f commit 21c1043
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions public/scripts/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,18 @@ let questionStartMS = 0;
$(document).ready(function() {
//$("#retryButton").toggleClass("on");
//alert($('li[data-keycode="test"]').attr('id'));
$.getJSON( "scripts/shortcuts.json", function( data ) {
allData = data;
if(localStorage.getItem("questionNo")==null){
fetch('scripts/shortcuts.json')
.then(response => response.json())
.then(data => {
allData=data
if(localStorage.getItem("questionNo")==null)
{
localStorage.setItem("questionNo", "1");
localStorage.setItem("totalCount", Object.keys(allData).length);
}
// Call readText()
readText()

updateTimingDisplay();
})
readText()
updateTimingDisplay()
});

$('.container').css('height', $(window).height());
$(window).on('resize', function() {
Expand Down

0 comments on commit 21c1043

Please sign in to comment.