I have below js function, I need to call /print2 function without clicking any buttons. I tried to write ajax to that. By the way, I am newer in ajax and js.
Where is the problem ı could not see ?
Thank you...
<script type="text/javascript" >
function plot() {
$.ajax({
url: '/print2',
success: function(data) {
console.log('get info');
$('#description').html(data['description']);
}
});
}
plot()
</script>
It says
(index):30 Uncaught ReferenceError: $ is not defined at plot ((index):30) at (index):38
Where is the problem ?
Edit
$(document).ready(function () {
//your code here
});
I wrapped my function with this code. As it stated here JQuery - $ is not defined
However, I it is not solve my problem.