If you would use jQuery I could give you an answer but ajax with vanilla js is not really intuitive.
If you speak german you can read this Tutorial as a startingpoint to understand how a loginform with ajax has to work: https://www.html-seminar.de/ajax-einfuehrung.htm
If not say something and I will take a look to an english one.
But the normal way is to send your form data to your controller, have in mind that a controllerfile will not work as a ajaxscript.
For this you can use a routing and set up your controller as a plugin like here: Where can I save my PHP-Files for AJAX?
cheers