mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Submit the form instead of refreshing the page
This commit is contained in:
parent
da6d57b77b
commit
982b0e950d
1 changed files with 16 additions and 6 deletions
|
@ -15,15 +15,25 @@ document.addEventListener( 'DOMContentLoaded', () => {
|
|||
headingRow.parentNode.insertBefore(newRow, headingRow.nextSibling);
|
||||
|
||||
|
||||
saveChangesButton.addEventListener('click', () => {
|
||||
form.querySelector('.' + publishButtonClassName).click();
|
||||
let isSaving = false; // Flag variable to track whether saving is in progress
|
||||
|
||||
// Delay the page refresh by a few milliseconds to ensure changes take effect
|
||||
setTimeout(() => {
|
||||
location.reload();
|
||||
}, 1000);
|
||||
saveChangesButton.addEventListener('click', () => {
|
||||
// Check if saving is not already in progress
|
||||
if (!isSaving) {
|
||||
isSaving = true; // Set flag to indicate saving is in progress
|
||||
|
||||
// Trigger the click event on the publish button
|
||||
form.querySelector('.' + publishButtonClassName).click();
|
||||
|
||||
// Trigger click event on saveChangesButton after a short delay
|
||||
setTimeout(() => {
|
||||
saveChangesButton.click(); // Trigger click event on saveChangesButton
|
||||
isSaving = false; // Reset flag when saving is complete
|
||||
}, 500); // Adjust the delay as needed
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
merchantConfigurators.Messaging({
|
||||
config: PcpPayLaterConfigurator.config,
|
||||
merchantClientId: PcpPayLaterConfigurator.merchantClientId,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue