I have a few queries that are quite big, i only want queries to run them once the page has finished loading.
This is what i have tried.
<head>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
    <script type="text/javascript">
        $(window).load(function() {
            $("#query").load("sql-query.php");
        });
    </script>
</head>
<div id="query">Loading...</div>
sql-query.php 
$data = DB::table('tapplicant')->limit(5000)->get();
var_dump($data);
The idea is to return the query data once the page has loaded.
 
     
     
    