How to call a coldfusion function using jquery on clicking a hyperlink

I have a cfm file that has a url that directs the page to another cfm page
I would like on clicking the url to call a coldfusion function befor going to the next page
example
I have a component mycomponent
<cfcomponent>
<cffunction name=“increaseviews”>.
<cfargument arg1…>
…</cffunction></cfcomponent>

I have a cfm
mypage.cfm
<a href=“mysecondpage.cfm”>go to second page</a>

secondpage.cfm
I am the second page

I want the user on clicking on the url the jquery will call the function increaseviews then go to secondpage.cfm

Thanks in advance

I think you don’t understand the difference between client side and server side code. JavaScript (and therefore jQuery) operate only in the browser. They can help the browser to send information to the server, but can’t control what the server does. So JavaScript can’t have any influence whatsoever over coldfusion.

You don’t need JavaScript for this. You could just do it using a query string:

<a href="mysecondpage.cfm?increaseviews=true">go to second page</a>

Then your cfm page needs to deal with the GET variable “increaseviews”. Then it needs to output the appropriate content for this second page.