Web page does not display published data


I have a table (I use the DataTables plugin for jQuery), and when I click on a row, I want to redirect to another page where client details will be displayed.

Here is my code in the customers.php file:

<script>
$(document).ready(function () {
    $('#customer').DataTable({
        serverSide: true,
        ajax: "customer-data.php",
        scrollY: 350,
        scrollX: true,
        deferRender: true,
        select:true,
        scroller: {
            loadingIndicator: true,
            displayBuffer: 4,
            serverWait: 100
        }
    });
    var table = $('#customer').DataTable();
    $('body').on('click', '#customer tbody tr', function () {
        var name = table.cell('.selected', 1).data();
        $.ajax({
            type: "POST",
            url: "customer_details.php",
            data: {name1: name},
            success: function() {
                window.location = "customer_details.php";
            }
        });
    });
});
</script>

This is customer_details.php

<div>Company name</div>
<div>
    <?php
    $name = $_POST['name1'];
    echo "$name";
    ?>
</div>

When I click on the line, they redirect me to the customer information page, but I do not see the data (i.e. the name). When I look at the response tab in the console in Firebug, I can see this data in a div.
Can someone help me what am I doing wrong?

+4
source share
1 answer

AJAX .

, -, ajax POST customer_details.php. ajax , POST XMLHttpRequest.
( : http://www.w3schools.com/ajax/ajax_xmlhttprequest_send.asp)

.

POST, .
( , : JavaScript, )

+1

Source: https://habr.com/ru/post/1616341/


All Articles