-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
42 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
html { | ||
font-family: 'Quicksand', sans-serif; | ||
background-color: rgb(245, 178, 178); | ||
} | ||
|
||
.hello { | ||
position: relative; | ||
text-align: center; | ||
} | ||
|
||
input { | ||
border-radius: 7px; | ||
border-color: green; | ||
} | ||
|
||
button { | ||
border: none; | ||
border-radius: 13px; | ||
background-color: rgb(193, 2, 138); | ||
color: white; | ||
padding: 5px; | ||
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); | ||
transition-duration: 200ms; | ||
} | ||
|
||
button:hover { | ||
transform: scale(1.3); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,94 +1,4 @@ | ||
const form = document.getElementById("credentials-form"); | ||
|
||
function redirect(txtNoMak, txtPwd) { | ||
const menuUrl = 'https://mrsmkualaklawang.edu.my/epelajar/MenuUtama.asp'; | ||
const formData = new FormData(); | ||
formData.append('txtNoMak', txtNoMak); | ||
formData.append('txtPwd', txtPwd); | ||
|
||
fetch(menuUrl, { | ||
method: 'POST', | ||
body: formData, | ||
mode: "no-cors" | ||
}).then(response => { | ||
if (response.status !== 200) { | ||
window.alert("error") | ||
console.log(response); | ||
} else { | ||
window.location.href = menuUrl; | ||
} | ||
}) | ||
} | ||
|
||
function unlockCORSAnywhere() { | ||
// Create a URL for the CORS Anywhere unlock endpoint | ||
const unlockURL = 'https://cors-anywhere.herokuapp.com/corsdemo'; | ||
|
||
// Send an OPTIONS request to the unlock endpoint | ||
fetch(unlockURL, { | ||
method: 'OPTIONS', | ||
headers: { | ||
'Origin': 'https://Hakimi0804.github.io', // Replace with your website's origin | ||
'Access-Control-Request-Method': 'POST', // Replace with the HTTP method you intend to use | ||
}, | ||
}) | ||
.then(response => { | ||
if (response.ok) { | ||
console.log('CORS Anywhere unlocked'); | ||
// You can now proceed to make POST requests | ||
} else { | ||
console.error('Failed to unlock CORS Anywhere'); | ||
} | ||
}) | ||
.catch(error => { | ||
console.error('Error:', error); | ||
}); | ||
} | ||
|
||
|
||
form.addEventListener('submit', function(event) { | ||
event.preventDefault(); | ||
|
||
const txtNoMak = document.getElementById('txtNoMak').value; | ||
const txtPwd = document.getElementById('txtPwd').value; | ||
|
||
console.log(`No. Maktab: ${txtNoMak}`); | ||
console.log(`No. KP: ${txtPwd}`); | ||
|
||
const menuUrl = 'https://mrsmkualaklawang.edu.my/epelajar/MenuUtama.asp'; | ||
const formData = new FormData(document.getElementById("credentials-form")); | ||
|
||
// fetch(menuUrl, { | ||
// method: 'POST', | ||
// body: formData, | ||
// mode: "no-cors", | ||
// }).then(response => { | ||
// if (!response.ok) { | ||
// window.alert("error"); | ||
// console.debug(response); | ||
// } else { | ||
// window.location.href = menuUrl; | ||
// } | ||
// }) | ||
|
||
unlockCORSAnywhere(); | ||
fetch('https://cors-anywhere.herokuapp.com/https://mrsmkualaklawang.edu.my/epelajar/MenuUtama.asp', { | ||
method: 'POST', | ||
body: formData, | ||
headers: { | ||
'X-Requested-With': 'XMLHttpRequest' // Required header for CORS Anywhere | ||
} | ||
}) | ||
.then(response => { | ||
if (response.ok) { | ||
console.log('Form data sent successfully'); | ||
window.location.href = menuUrl; | ||
} else { | ||
window.alert("error"); | ||
console.error('Failed to send form data'); | ||
} | ||
}) | ||
.catch(error => { | ||
console.error('Error:', error); | ||
}); | ||
}); | ||
const button = document.getElementById("btn"); | ||
button.addEventListener("click", () => { | ||
document.getElementById("btn").innerText = "Loading..."; | ||
}) |