Can you add custom data to the POST that the ssp_script uses before calling ssp.class.php?

Can you add custom data to the POST that the ssp_script uses before calling ssp.class.php?

kilo_bravokilo_bravo Posts: 2Questions: 1Answers: 0

I am just in the beginning stages of setting up using Server Side Processing. I can send just a basic query and get back data, but I need to create a more advanced query and am having trouble getting the criteria into the server_processing.php script. The $_POST seems to be getting "scrubed" by the DataTables code before it arrived at the script. Here is an example of my AJAX calling the script:

                 $('#trans_manager').dataTable({
                                                        'processing': true,
                                                        'serverSide': true,
                                                        'ordering': true,
                                                        'order': [[ 5, 'desc' ]],
                                                        'pageLength': 25,
                                                        'ajax': {
                                                                'url': './modules/tm_server_processing.php',
                                                                'type': 'POST'
                                                                },
                                                        'columns': [
                                                            {'data': 0,
                                                             'name': 'site_id'},
                                                            {'data': 1,
                                                             'name': 'customer_id'},
                                                            {'data': 2,
                                                             'name': 'processor_id'},
                                                            {'data': 3,
                                                             'name': 'subscription_id'},
                                                            {'data': 4,
                                                             'name':'transaction_id'},
                                                            {'data': 5,
                                                             'name': 'transaction_date'},
                                                            {'data': 6,
                                                             'name': 'transaction_amount',
                                                             'orderable': false}
                                                        ],
                                                        'dom': '<\'top\'lpf>rt<\'bottom\'lip<\'clear\'>>',
                                                        'extra_data': 'Test Value'
                         });

I'm trying the get the "extra_data" to show up in the $_POST, but when I log the $_POST in the top of the script it looks like this:

server_processing: Array
(
[draw] => 1
[columns] => Array
    (
        [0] => Array
            (
                [data] => 0
                [name] => site_id
                [searchable] => true
                [orderable] => true
                [search] => Array
                    (
                        [value] =>
                        [regex] => false
                    )

            )

        [1] => Array
            (
                [data] => 1
                [name] => customer_id
                [searchable] => true
                [orderable] => true
                [search] => Array
                    (
                        [value] =>
                        [regex] => false
                    )

            )

        [2] => Array
            (
                [data] => 2
                [name] => processor_id
                [searchable] => true
                [orderable] => true
                [search] => Array
                    (
                        [value] =>
                        [regex] => false
                    )

            )

        [3] => Array
            (
                [data] => 3
                [name] => subscription_id
                [searchable] => true
                [orderable] => true
                [search] => Array
                    (
                        [value] =>
                        [regex] => false
                    )

            )

        [4] => Array
            (
                [data] => 4
                [name] => transaction_id
                [searchable] => true
                [orderable] => true
                [search] => Array
                    (
                        [value] =>
                        [regex] => false
                    )

            )

        [5] => Array
            (
                [data] => 5
                [name] => transaction_date
                [searchable] => true
                [orderable] => true
                [search] => Array
                    (
                        [value] =>
                        [regex] => false
                    )

            )

        [6] => Array
            (
                [data] => 6
                [name] => transaction_amount
                [searchable] => true
                [orderable] => false
                [search] => Array
                    (
                        [value] =>
                        [regex] => false
                    )

            )

    )

[order] => Array
    (
        [0] => Array
            (
                [column] => 5
                [dir] => desc
            )

    )

[start] => 0
[length] => 25
[search] => Array
    (
        [value] =>
        [regex] => false
    )

)

The "extra_data" that I'm trying to send with the $_POST seems to be getting removed. I'm sure I'm just doing something wrong, but can't seem to find an example of how to do this properly.

Thank you for your help.

This question has an accepted answers - jump to answer

Answers

  • jLinuxjLinux Posts: 981Questions: 73Answers: 75
    Answer ✓

    Do you mean like the ajax.data ?

  • kilo_bravokilo_bravo Posts: 2Questions: 1Answers: 0

    jLinux, yea, that looks like what I needed, thanks. I actually tried something similar, but it wasn't wrapped in the function - which is why it failed I'm suspecting.

    Thanks for the answer.

  • jLinuxjLinux Posts: 981Questions: 73Answers: 75

    No problem sir.

    It takes an anonymous function as well, so you can do pretty much anything with it

This discussion has been closed.