Skip to content

Commit

Permalink
fixed now server can interact through api
Browse files Browse the repository at this point in the history
  • Loading branch information
isaka-james authored Aug 10, 2023
1 parent b41a3d9 commit 78dc1bb
Showing 1 changed file with 21 additions and 24 deletions.
45 changes: 21 additions & 24 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -281,41 +281,38 @@ <h2 style="padding-left: 15px;">Your Performance</h2>
`;
$('#performanceCard').html(cardContent).show().addClass('animate__slideInRight');

// Get the user agent of the browser
var userBrowser = navigator.userAgent;

// Get the current date and time
var currentTime = new Date().toLocaleString();

// Get the user agent of the browser
var userBrowser = navigator.userAgent;

// Get the current date and time
var currentTime = new Date().toLocaleString();

// Data to send in the POST request
var postData = {
// Data to send in the POST request
var postData = {
website: 'keyboard',
pname: data.name,
timezone: currentTime,
wpm: data.wpm,
accuracy: data.accuracy,
correct_words: data.correctWords,
incorrect_words: data.incorrect_words,
incorrect_words: data.incorrectWords,
elapsed_time: data.elapsedTime,
start_time: data.startTime,
browser: userBrowser
};

// Make the POST request
$.post('https://masterplan-api.000webhostapp.com/api/add_tracker.php', postData)
.done(function(response) {
if (response === 'good') {
console.log('Request successful:', response);
} else {
console.log('Request failed:', response);
}
})
.fail(function() {
console.log('Error: Failed to send POST request.');
});
});
};

// Make the POST request
$.post('https://masterplan-api.000webhostapp.com/api/add_tracker.php', postData)
.done(function(response) {
if (response === 'good') {
console.log('Request successful:', response);
} else {
console.log('Request failed:', response);
}
})
.fail(function() {
console.log('Error: Failed to send POST request.');
});
}

function displayPerformanceComment(accuracy) {
Expand Down

0 comments on commit 78dc1bb

Please sign in to comment.