I have a very straight forward jQuery ajax function in my 'funcs.js' file:
$('#selecDate').on('DOMSubtreeModified',function(){
$.ajax({
type: 'POST',
url: '/revenue',
data: {'name' : 'John Doe'},
success: function(response){
console.log(response);
$('th').text(response);
},
error: function(response){
console.log(response);
},
});
});
This is my 'funcs.js' file entire content. Why does this function being called automatically when page loads and how can i avoid it? thx