Skip to content

Commit

Permalink
Update ajax.js
Browse files Browse the repository at this point in the history
Signed-off-by: Ismail irfan <98257637+Ismailirfan@users.noreply.github.com>
  • Loading branch information
Ismailirfan authored May 26, 2024
1 parent 6c05dbb commit c9bbf13
Showing 1 changed file with 36 additions and 36 deletions.
72 changes: 36 additions & 36 deletions ajax.js
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@
//  $.ajax({url: "shortcutkeys.html", success: function(result){
//      $("#Shortcutkeys").html(result);
//   }});
 $.ajax({url: "shortcutkeys.html", success: function(result){
     $("#Shortcutkeys").html(result);
  }});

// Tabbed Menu

//$(document).ready(function() {
// const API_KEY = 'AIzaSyAAVEyh_nSUsyhpZq-N1oeb1qGNanbz_Kc';
// const FOLDER_ID = '1_iCnZEDJpQEK524YzL3v8RWUtM9sDqge'; // Replace with your public Google Drive folder ID
$(document).ready(function() {
const API_KEY = 'AIzaSyAAVEyh_nSUsyhpZq-N1oeb1qGNanbz_Kc';
const FOLDER_ID = '1_iCnZEDJpQEK524YzL3v8RWUtM9sDqge'; // Replace with your public Google Drive folder ID

// listFiles(); // Automatically fetch files when the page loads
listFiles(); // Automatically fetch files when the page loads

// function listFiles() {
// $.ajax({
// url: `https://www.googleapis.com/drive/v3/files?q='${FOLDER_ID}'+in+parents+and+mimeType='text/html'&key=${API_KEY}`,
// method: 'GET',
// success: function(data) {
// $('#fileList').empty();
// data.files.forEach(function(file) {
// fetchFileContent(file.id);
// });
// },
// error: function(error) {
// console.error('Error:', error);
// }
// });
// }
function listFiles() {
$.ajax({
url: `https://www.googleapis.com/drive/v3/files?q='${FOLDER_ID}'+in+parents+and+mimeType='text/html'&key=${API_KEY}`,
method: 'GET',
success: function(data) {
$('#fileList').empty();
data.files.forEach(function(file) {
fetchFileContent(file.id);
});
},
error: function(error) {
console.error('Error:', error);
}
});
}

// window.fetchFileContent = function(fileId) {
// $.ajax({
// url: `https://www.googleapis.com/drive/v3/files/${fileId}?alt=media&key=${API_KEY}`,
// method: 'GET',
// success: function(data) {
// $('#fileContent').html(data);
// $('#mymodal').modal('show'); // Show the modal with fetched content
// },
// error: function(error) {
// console.error('Error:', error);
// }
// });
// }
// });
window.fetchFileContent = function(fileId) {
$.ajax({
url: `https://www.googleapis.com/drive/v3/files/${fileId}?alt=media&key=${API_KEY}`,
method: 'GET',
success: function(data) {
$('#fileContent').html(data);
$('#mymodal').modal('show'); // Show the modal with fetched content
},
error: function(error) {
console.error('Error:', error);
}
});
}
});

0 comments on commit c9bbf13

Please sign in to comment.