简体   繁体   中英

Submit data table search form on page load

I am using a data table script found at http://datatables.net/ref

This is the code I am using so far to just add the value to the search field. However it doesnt actually search the data table unless the user presses enter or adds/deletes a character in the search box. Refer to the link for a demo of exactly what it does, just type something in their search box.

<script type="text/javascript">
       window.onload = (function() {
           document.getElementById('search').value = " <?php echo $st;?>";
</script>

Thanks in advance for your help!

As far as I understand your question. You want when user enters any character or word , it should display all matching result in table format.

So for this you have to use onkeyup event of this search box and call ajax function for sending the input and displaying the result.

Hopes it clarifies your doubt. If any problem comes comment it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM