Passing Variables from PHP/MySQL - jQuery Best Practices

Passing Variables from PHP/MySQL - jQuery Best Practices

On our WordPress site, I have created a page to:
(a) search our extensive database (via a mysql query in php) for particular strings ($search and $search2) using two search boxes with and/or radio buttons,
(b) return a two-column table (columns: DATE and EVENT) where one and/or another of the strings is found in the EVENT column,
(c) paginate the results when they exceed 100 rows, with one-click navigation to the additional pages, and
(d) highlight the found strings in yellow using the mark.js jQuery plugin.
The mark.js plug-in works properly when I hard code $search and $search2 (e.g., var keywords = ["disease", "epidemic"];, but I need pass these variables to the mark.js plug-in on the first returned page with a table and any additional pages of tables so it know what strings to hghlight. Note that after they are input to php via the forms, I don't currently have the values of $search and $search2 displayed on the returned pages (other than where they appear in the table), but I could if needed to pass them to jQuery.

As I am new to jQuery (and everything else above), my question is: what is the best practice in jQuery to obtain these variables? I have explored this forum and "stack", but am confused. Should I be creating an html element or a hidden field to hold them? Or is it better to take these variables directly from the php code?

Many thanks to anyone who replies. If I should have posted code above, please let me know.  I didn't because I don't mind trying to work these things out myself after being pointed in the right direction.