VikingGoat
VikingGoat

Reputation: 477

Sending search request to Datatables jquery plugin

Has anyone ever sent a search request from one page to the dataTables jquery plugin on another page? I'm not sure if its even designed to work that way.

Upvotes: 0

Views: 1531

Answers (2)

Hendry B
Hendry B

Reputation: 11

I think this is what you are looking for:

$('#dataTableBLOCK').dataTable( {
    "oSearch": {"sSearch": "YOUR-SEARCH-VALUE"},
    "bProcessing": true,
    "bServerSide": true,
    "sAjaxSource": "NAME-OF-DATATABLES-FILE.php"
} );

By changing YOUR-SEARCH-VALUE to a $_POST or $_GET value you make dataTables search what you were searching somewhere else.

Upvotes: 1

Samuel Chandra
Samuel Chandra

Reputation: 1185

I am very sure that the search will only work when you are in the same page. The search box will filter the displayed rows of the table when the dataTables plugin is used.

Upvotes: 0

Related Questions