Pagination CSS may fail to function properly in Chrome after an AJAX call is returned

Having an issue with CSS not getting applied correctly after making an AJAX call with pagination. The problem seems to be specific to Chrome, as it works fine in Firefox. When inspecting the element, the CSS is present but not being applied properly until manually adjusted.

Note: This example only showcases a limited number of results for the "yacht-charter" div.

Any help or suggestions would be greatly appreciated.

Thanks!

<div class="row text-center mx-auto p-lg-5"><span class="my-auto mr-5">Filter:</span>
    <form id="luxury-form" class="w-75 d-flex">
        <select id="no_of_passengers" name="no_of_passengers" class="custom-select mr-5">
            <option value="-1"># of Passengers</option>
            <option value="1">1</option>
            <option value="2">2</option>
            <option value="3">3</option>
            <option value="4">4</option>
            <option value="5">5</option>
            <option value="6">6</option>
            <option value="7">7</option>
            <option value="8">8</option>
            <option value="9">9</option>
            <option value="10">10</option>
            <option value="11">11</option>
            <option value="12">12</option>
            <option value="13">13</option>
            <option value="14">14</option>
            <option value="15">15</option>
            <option value="16">16</option>
        </select><select id="boat_type" class="custom-select" name="boat_type">
            <option value="all">Boat Type</option>
            <option value="Sailing">Sailing</option>
            <option value="Motor sailor">Motor Sailor</option>
            <option value="Motor">Motor</option>
        </select>
    </form>
</div>
<div class="row w-100" id="yacht-charter">
    <div class="box col"><img src="https://poseidon-dev.axon-media.com/wp-content/uploads/Irene-Hero.jpg" data-id="2264" alt="2264">
        <div class="yacht-feature-inner"><a href="https://poseidon-dev.axon-media.com/product/irenes">
                <h3 class="heading2 minerva-font">IRENE’S</h3>
                <p>4 Cabins | 4 CREWS | VIEW DATES AND RATES &gt;</p>
            </a></div>
    </div>
    <div id="luxury-pagination" class="row heading3 font-weight-light w-75 mx-auto pt-5 justify-content-center"><span aria-current="page" class="page-numbers current">1</span>
        <a class="page-numbers" href="https://poseidon-dev.axon-media.com/destination/greece/luxury-crewed-yacht-charter?paged=2">2</a>
        <a class="page-numbers" href="https://poseidon-dev.axon-media.com/destination/greece/luxury-crewed-yacht-charter?paged=3">3</a>
        <a class="page-numbers" href="https://poseidon-dev.axon-media.com/destination/greece/luxury-crewed-yacht-charter?paged=4">4</a>
        <a class="next page-numbers" href="https://poseidon-dev.axon-media.com/destination/greece/luxury-crewed-yacht-charter?paged=2"><i class="fas fa-angle-right"></i></a></div><!-- navigation ENDS -->
</div>
<script type="text/javascript">
        var url = "<?php echo admin_url('admin-ajax.php');?>";
        var cur_uri = "<?php echo $_SERVER['REQUEST_URI']?>";
        var nonce = "<?php echo wp_create_nonce('luxury_filters'); ?>";
        jQuery(document).ready(function ($) {
            jQuery("#no_of_passengers").change(function (e) {
                e.preventDefault();
                var data = {
                    action: 'luxury_filter',
                    passengers : jQuery(this).val(),
                    boat : jQuery('#boat_type').val(),
                    category : 'luxury-charter',
                    uri : cur_uri,
                    cols : 6,
                    nonce: nonce
                };
                jQuery.ajax({
                    url : url,
                    type: 'post',
                    data: data,
                    success: function (response) {
                        jQuery("#yacht-charter").replaceWith(response);
                    }
                });

            });
                jQuery(document).on("change", "#boat_type", function(e) {
                var data = {
                    action: "luxury_filter",
                    boat : jQuery(this).val(),
                    passengers : jQuery("#no_of_passengers").val(),
                    uri : cur_uri,
                    category : "luxury-charter",
                    cols : 6,
                    nonce: nonce,
                    async: false
                };
                jQuery.ajax({
                    url : url,
                    type: "post",
                    data: data,
                    dataType: "html",
                    success: function (response) {
                        jQuery('#yacht-charter').empty();
                        jQuery('#yacht-charter').append(response);
                    }
                });

            });
        });
    </script>

Answer №1

swapOut Swaps out the element itself. In contrast, XHTML swaps out the content of the element.

Therefore, I recommend switching swapOut to XHTML.

You can also update the empty/append to XHTML in your other ajax request.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Troubleshooting Problem with JQuery in the YouTube Player API

Having some difficulty parsing YouTube video ids to a function that plays them in an embedded player using a combination of JavaScript and jQuery with the YouTube Data and Player APIs. Below is my code: <html> <head> <script src="//aj ...

In JavaScript, the clearTimeout function may not always return a

Could someone please help me troubleshoot the issue in my code snippet below? I am trying to declare a public variable and assign it to a setTimeout function. If the variable is not null, I want to clear the timeout before setting it again. However, when ...

Issues with data loading from server persist with JSON in JQuery Datatables on IE7, IE8, and IE9

I have successfully implemented Jquery Datatables on a client's admin panel. After testing it on Chrome, Firefox, and Opera, everything seemed to be working perfectly. However, when I attempted to load it on IE7, IE8, or IE9, the system just stuck on ...

What are the tips for aligning this button perfectly on the page, despite being centered in a computer's resolution?

Dealing with Responsive Design Hey there! I'm having an issue with my Bootstrap layout. I managed to center a button, but when I adjust the resolution or make it smaller, the button wraps and shifts to the right. Can anyone help me figure out what we ...

When you scroll through the page, white blocks suddenly appear

After completing a website, I noticed some white blocks appearing when scrolling. You can view the site here. This issue occurs on both mobile and desktop devices during the initial load only. Could this indicate that the page has not fully loaded yet? If ...

White background with a black border and transparency on an Android device

I'm trying to create a shape that has a white background with a black border. <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item> <shape android:shap ...

The webpage becomes unresponsive and gets stuck when sending a stream of requests to the web server via ajax

I am currently working on creating a signal on the webpage that displays either a green or red color based on values retrieved from a database. However, when I send a request after 10 seconds, the page appears to freeze and becomes unresponsive. I am strug ...

Exploring Alternative Methods to Navigate Through Elements Using JQuery UI Autocomplete

After testing two different approaches: <div id = "team-search-container"> <label for="team-search" class = "text-center"> <input type = "text" id = "team-search"> </label> </div> With the following code sni ...

Is it possible to target the initial sibling of a parent element using a CSS selector?

Is there a way to target the <p> element using only the id "Standort" as a constant? Any suggestions on how to accomplish this? <section> <header> <h2 class="licht"><span id="Standort" class="-sitemap-select-item-select ...

Updating a jQuery div issue

Hey there, I apologize for bothering you again, but I'm facing another issue with jQuery. It's the same code. $('.tab').click(function() { $(this).unbind("click"); var classy = $(this).attr("class").split(" ").splice(- ...

What are some effective ways to manage errors in Ajax deferred calls?

What is the best way to handle an Ajax deferred error? function CallingApi() { return $.ajax({ url: 'http://localhost:10948/Api/Home/GetEmployee123', contentType: 'application/x-www-form-urlencoded', ...

Encountering a 405 Error during the transfer of data from a Jquery Ajax call to an

Currently, I have an AJAX call where I am sending the following data: data: JSON.stringify({ data: holder, customer: customerID }), The variable 'holder' is actually an array that contains these values: [1, 2, 3, 4] Additionally, 'custom ...

The Impreza theme is experiencing difficulty displaying Font Awesome icons

Recently, I had a client who needed a WordPress website. After working on the project on my own server, I finally completed it and transferred the entire site to the client's main domain at gulugalmarketing.com. Everything was functioning perfectly o ...

If the iframe's CSS source is updated, the parent's CSS source will also change

I'm currently working on a unique school project that involves creating multiple CSS styles for different views. <link rel="stylesheet" type="text/css" href="css/main.css" title="main" media="screen"> <link rel="stylesheet" type="text/css" h ...

How do I submit a form using jQuery .ajax() or .post() in a native iPhone Phonegap application?

Can someone help me figure out how to use jQuery's .ajax() or .post() in a Phonegap Native iPhone App to send data to a php file on my webserver? Do I need to format the data as xml or json, or can I simply send regular html post data? If anyone has ...

Display only alphabetic characters in the text field

I have a jQuery function that I am working on: $('#contact_name').on('input', function() { var input=$(this); var re =/^[A-Za-z]+$/; var is_email=re.test(input.val()); if(is_email) { } else { } }); This function is targeted at the fol ...

Repetition of UTM Parameters

I created a web page with a donation form embedded in it. Donors visiting the page come through a link that includes a source code at the end. I managed to include this source code in the URL of the embedded form using the following code: $(document).ready ...

What is the best way to pick out specific passages of text

I'm attempting to create an autocomplete feature where the data is displayed in a div below the text box as the user types. While this typically involves ajax, I've simplified the approach without using jQuery autocomplete. Once the text appears ...

Issues with table nesting functionality

I'm attempting to organize tables in a nested manner, instead of placing a table within each cell. My engineers have advised against simply styling the table to appear nested, and suggested that it would be more effective to wrap each header around th ...

Issue with Ajax call not displaying the jQuery dialog box

Could you please take a look at this jsFiddle link... The issue lies with a jQuery UI dialog box that uses an ajax request to fetch content. Unfortunately, all I see is a blank dialog and can't seem to pinpoint the problem. A snippet of the HTML cod ...