Skip to content

Commit

Permalink
Merge pull request #3821 from SrijaVuppala295/buy
Browse files Browse the repository at this point in the history
Redirection to Home Page after Buying !!!
  • Loading branch information
sailaja-adapa authored Oct 21, 2024
2 parents dc468a0 + 0e459ae commit d82aa51
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions assets/js/checkout.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@

/* COPY INPUT VALUES TO CARD */
const bounds = document.querySelectorAll('[data-bound]');

for(let i = 0; i < bounds.length; i++) {
for (let i = 0; i < bounds.length; i++) {
const targetId = bounds[i].getAttribute('data-bound');
const defValue = bounds[i].getAttribute('data-def');
const targetEl = document.getElementById(targetId);
bounds[i].addEventListener('keyup', () => targetEl.innerText = bounds[i].value || defValue );
bounds[i].addEventListener('keyup', () => targetEl.innerText = bounds[i].value || defValue);
}


/* TOGGLE CVC DISPLAY MODE */
const cvc_toggler = document.getElementById('cvc_toggler');

Expand All @@ -19,8 +17,6 @@ cvc_toggler.addEventListener('click', () => {
el.setAttribute('type', el.type === 'text' ? 'password' : 'text');
});



const timer = document.querySelector('[data-id=timer]');
let timeLeft = 5 * 60;

Expand Down Expand Up @@ -48,12 +44,17 @@ function showNotification(message) {
icon: 'success',
title: message,
showConfirmButton: false,
timer: 2000
timer: 3000
});

// Redirect to the homepage after notification
setTimeout(() => {
window.location.href = '/'; // Update this with the actual home page URL
}, 2000); // Matches the timer duration of the notification
}

document.getElementById('paymentForm').addEventListener('submit', function(event) {
event.preventDefault(); // Prevent form
document.getElementById('paymentForm').addEventListener('submit', function (event) {
event.preventDefault(); // Prevent form submission
showNotification('Payment confirmed! Your order is being processed.');
});

Expand Down

0 comments on commit d82aa51

Please sign in to comment.