In this video, we are going implement JS callback on Drupal 8 AJAX form submit.
If you liked this video, please also have a look at my new course about Drupal 8 module development here (with 50% discount):
https://goo.gl/LPyeDw
We are going to use as a starting point a module that we created in another video, which you may watch here: • 🚀 Creating an AJAX Form into our Drup...
The GitHub repo of that module is located here:
https://github.com/drupal-up/ajax_for...
In general, we are going to change the form that we are going to get with the module and we are going to convert it to a form with just one text field and a button. We are going to change a bit the responding callback in our form class.
Afterwards, we are going to declare a .libraries.yml file and a JS file with a simple callback that is going to log messages to our browser console.
The end code of this example you may find here:
https://github.com/drupal-up/ajax_for...
Thanks for watching and keep having fun with Drupal 8 ;)