boycod3
boycod3

Reputation: 5319

send parameter with jquery datatables

This is my sample code populating data table on my app.But i want to send a parameter with the url !!

Parameter name 'form' integer value.

 $(document).ready(function() {
        $('#example').DataTable( {
            "processing": true,
            "serverSide": true,
            "ajax": {
                "url": "getKeyDetails.html",

            }
        });
    });

Upvotes: 0

Views: 66

Answers (1)

vijayP
vijayP

Reputation: 11502

Considering above inputs from your end you can check below code:

$(document).ready(function() {
        var paramValue = $("#yourSelectBoxID").val();

        $('#example').DataTable( {
            "processing": true,
            "serverSide": true,
            "ajax": {
                "url": "getKeyDetails.html?form="+paramValue,

            }
        });
});

Here we are assuming that there is a select box on your page with an id yourSelectBoxID. So whatever value is selected on DOM ready; that value will be passed within URL to the server side.

Upvotes: 1

Related Questions