JQuery / Ajax call onClick to Post data to a file

Hi Wappler Community,
Coming to you to see if something is possible with Wappler.
I have an element that opens/closes a Collapse area.

<h5 dmx-on:click="collapseThread.toggle()">Collapse this thread</h5>

I would also like to send data to a php file (a webhook, really), for example through an Ajax call like

$.ajax({ type: 'POST', url: 'somefile.php', data: { text1: val1, text2: val2 }   });

How/where would I put this in an onClick, and is there a way to do this using Wappler functions?

Thank you!

Community Page
Last updated: