Send custom data via ajax

Send custom data via ajax

pcpartnerpcpartner Posts: 6Questions: 2Answers: 0

Hi,

When trying to fetch data from a ajax request:

editor2 = new $.fn.dataTable.Editor({
                ajax: {
                    url: "../ajax/ploegen.php",
                    data: {
                        "club_id": 1
                    }
                },
                table: "#example2",
...

We try to add the variable "club_id". but if we check what the browser is sending we only see this:
_: "1492005302272"
It's own data instead of the variable what I'm trying to send.
What are we missing?
Thanks

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    edited April 2017 Answer ✓

    For Editor, could you try using:

    editor2 = new $.fn.dataTable.Editor({
                    ajax: {
                        url: "../ajax/ploegen.php",
                        data: function ( d ) {
                            d.club_id = 1;
                        }
                    },
                    table: "#example2",
    

    please?

    Thanks,
    Allan

This discussion has been closed.