theme development – Woocommerce AJAX filters option loading spiner – problem on mobile device
Question
I’ve got quite weird problem. I built product filtering options, sometimes the server is slower so I wanted to add a loading spinner while you wait for the results. I only managed 50% because it works on desktop browsers and, unfortunately, nothing shows on mobile. Anyone have an idea why this can happen?
$('.auto_submit_item').change(function(){
var filter = $('#filter');
jQuery('#m-spinner').addClass('is-active');
$.ajax({
url:filter.attr('action'),
data:filter.serialize(), // form data
type:filter.attr('method'), // POST
beforeSend:function(xhr){
// jQuery('#m-spinner').addClass('is-active'); //option2
},
success:function(data){
// jQuery('#m-spinner').removeClass('is-active'); //option2
$('#response').html(data);
}
}, function( response ) {
jQuery('#m-spinner').removeClass("is-active");
});
return false;
});
I tried both options, one which is visible right now, and second one which is in comments. Both options work on desktop but dont work on mobile android and/or iOS.
Any idea how to fix it?
0
2 years
2022-04-01T06:26:53-05:00
2022-04-01T06:26:53-05:00 0 Answers
0 views
0
Leave an answer