Ajax ASP.NET Core
@section scripts{ <script> document.forms[0].onsubmit = () => { let formData = new FormData(document.forms[0]); var xhr = new XMLHttpRequest(); xhr.onreadystatechange = function() { if (this.readyState === 4 && this.status === 200) { alert('Posted using XMLHttpRequest'); } }; xhr.open('post', '', true); xhr.send(new URLSearchParams(formData)); return false; };</script>}
Gleaming Goshawk