Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Ajax form is not working inside my razor view

$
0
0

I have the following code inside my razor view:-

<form method="get" data-ajax="true" data-ajax-url="/Submission/Create" data-ajax-method="get" data-ajax-update="#panel" data-ajax-failure="failed"><div class="form-group"><input type="submit" value="Submit" class="btn btn-primary" /></div></form>

@section Scripts {
@{await Html.RenderPartialAsync("_ValidationScriptsPartial");
<script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js"></script>}

which generated the following markup:-

<form method="get" data-ajax-failure="failed" data-ajax-update="#panel" data-ajax-method="get" data-ajax-url="/Submission/Create" data-ajax="true"><div class="form-group"><input class="btn btn-primary" type="submit" value="Submit"></div></form>

now the result i should have got is that when i click on the submit button to call the /Submission/Create/ action method, but what is happening is that the form will refresh the current page /Home/Index/ so can anyone advice?


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>