I have a function which sends data to a server using ajax:
function firstScanStatIncrement(a) {
$.ajax({
url: "/my_url",
type: "get",
data: {
attr: a,
report_action: "report_action"
}
});
}
and I want to call the function when specific button is clicked. I do it like this:
$("#to-my-account").on("click", firstScanStatIncrement("account_page"));
but the function is called right after my page has been loaded. What do I do wrong?