Ajax post does not work on mobile
Hello,
I am creating a filter for my website with ajax and it works correctly from the computer. But when I enter from any mobile (android, ios, etc) it does not show the results.
The code I use is as follows:
jQuery version: v3.3.1
- <script>
- $(document).ready(function(){
- filter_data();
- function filter_data()
- {
- $('.filter_data').html('<div class="spinner-border" role="status"></div>');
- var action = 'fetch_data';
- var categoria = get_filter('categoria');
- var etiqueta = get_filter('etiqueta');
-
- $.ajax({
- type:"POST",
- url:"category.php",
- cache: false,
- data:{action:action, categoria:categoria, etiqueta:etiqueta},
- success:function(data){
- $('.filter_data').html(data);
- }
- });
-
- }
- function get_filter(class_name)
- {
- var filter = [];
- $('.'+class_name+':checked').each(function(){
- filter.push($(this).val());
- });
- return filter;
- }
- $('.common_selector').click(function(){
- filter_data();
- });
-
- });
- </script>
I find it very strange that it works on PC but not on mobile. What's going on?
I've been looking on the internet but I can't find a solution :/
Sorry for my bad English, I use translator.