Request performance using Html.BeginForm versus jQuery AJAX

1

Is there any gain in performance when using jQuery to perform ajax requests in relation to the post using Html.BeginForm?

@using (Html.BeginForm("Create", "Teste")
    {
        @Html.AntiForgeryToken()
        @Html.ValidationSummary(true, "", new { @class = "text-danger" })
        <div class="form-group">
           @Html.LabelFor(m => m.Nome, new { @class = "col-md-2 control-label" })
        <div class="col-md-10">
        @Html.TextBoxFor(m => m.Nome, new { @class = "form-control" })
        <span class="help-block">@Html.ValidationMessageFor(model => model.Nome, "", new { @class = "text-danger" })</span>
   }
   <div class="form-group">
      <div class="col-md-offset-2 col-md-10">
         <input type="submit" class="btn btn-default" value="Enviar" />
      </div>
   </div>

If it is better to do via ajax request, do you have any sample code where you deal with ValidationSummary and ValidationMessageFor?

    
asked by anonymous 01.12.2016 / 07:25

1 answer

1

The truth is that there is no relationship between the two practices, so to speak.

The Html.BeginForm() is still running on the server, it only helps - after all, it is a HTML Helper - to create the tags <form></form> .

As for jQuery, it runs on the client side of the browser, well after the BeginForm() lifecycle has ended.

    
01.12.2016 / 08:30