microsoft.jquery.unobtrusive.ajax razor page data-ajax-method handler code example
Example: mvc ajax unobtrusive before submit .net core
@page@model IndexModel<form method="post" data-ajax="true" data-ajax-method="post" data-ajax-complete="completed"> Name: <input type="text" name="name" /><br> <input type="submit"/></form>@section scripts{ <script src="~/lib/jquery-ajax-unobtrusive/jquery.unobtrusive-ajax.min.js"></script> <script> completed = function (xhr) { alert(`Hi ${xhr.responseText}!`); }; </script>}