products page spinner when pressing add to cart

28.04.2022 01:06
#1
tracker2
Joomshopping forum user no avatar
Name: Janne Leppänen
06.04.2022
Posts: 64
Quote
products page spinner when pressing add to cart

Hi I need to add somekind of spinner when pressing add to cart button.
I managed to add spinner when pressing the button but my solution does not continue to the submitted url it just displays its own success span id...

any example code to add product_default.php?

 
28.04.2022 02:14
#2
tracker2
Joomshopping forum user no avatar
Name: Janne Leppänen
06.04.2022
Posts: 64
Quote
Aw: products page spinner when pressing add to cart

figured it out.
<script>
var zyllemMain = (function() {
function processSubmitLoader() {
$("button[data-spinning-button]").click(function(e) {
var $this = $(this);
let formId = $this.data("spinning-button");
let $form = formId ? $("#" + formId) : $this.parents("form");
if ($form.length) {
//form.valid() will be applicable If you are using jQuery validate https://jqueryvalidation.org/
//asp.net mvc used it by default with jQuery Unobtrusive Validation
//you need to check the form before it goes into the if statement
//if ($form.valid()) {
$this
.append("<i class='fa fa-spinner fa-spin'></i> Tarkistetaan tunnuksen saatavuutta")
.attr("disabled", "");
setTimeout(() => {
$form.submit();
}, 2000);
//}
}
});
}
return {
initSpinnerButton: processSubmitLoader
};
})();

$(document).ready(function() {
zyllemMain.initSpinnerButton();
});
</script>

and change the submit button input to buttom type..

 


Copyrights MAXXmarketing GmbH. Alle Rechte vorbehalten
Durch die Nutzung dieser Website stimme ich zu, dass Cookies zur optimalen Gestaltung der Website sowie zur Analyse der Nutzung der Website verwendet werden. Weiterführende Informationen finden Sie hier. OK, einverstanden.