Y
Y
yischyk2021-08-10 00:39:46
AJAX
yischyk, 2021-08-10 00:39:46

AJAX request inside Swup library?

I'm working with the Swup library (which I use to keep site pages updated without reloading).

But on one of the pages, I am forced to make another AJAX request (does not concern the library, just a normal request).

As a result, this ajax request is not executed if you go from one page to another (without reloading) (because the swup library is included and the request is received in the request). If you reload that page with the request, then everything is ok.

Can I somehow make the request work even with the library?

<script type="text/javascript">
            $(document).ready(function(){
                $.ajax({
                    url: "/app",
                    type: "GET",
                    cache: false,
                    beforeSend: function() {
                        $('#datatables').html('Получаем контент');
                    },
                    success: function(html){
                        $("#datatables").html(html);
                    }
                });
                return false;
            });
   </script>

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question