I am finding a tutorial for AJAX in magento 2. How can I use javascript to trigger a PHP function in Magento 2. In Wordpress, we have this:

<https://codex.wordpress.org/AJAX_in_Plugins>

I don't know if it is the same for Magento or in Magento world, we use different thing.