I try to call my .php file (containing sql query for my database) from another .php file like the following:
...
<canvas id="myCanvas" width="600" height="100"></canvas>
<script>
function parseData(data) {
console.log(data);
}
function mainFunction() {
$.post('ajaxQueries/numberOfTrucksInWeek.php'), {}, function (data) {
if (typeof data === 'object') {
parseData(data);
}
}
}
mainFunction();
When I run this code, I get the following error:
Uncaught ReferenceError: $ is not defined
And not sure why this happens, as the syntax of ajax requests I used above should be correct. Anyone see my mistake?