Synchronous Xmlhttprequest on the main thread is deprecated because of its detrimental effects to the end user’s Experience

Asked

Viewed 572 times

1

When I include @Scripts.Render("~/bundles/jqueryval") at the bottom in partialview I get warning on log:

Synchronous Xmlhttprequest on the main thread is deprecated because of its detrimental effects to the end user’s Experience.

This warning appears when opening modal bootstrap.

I need @Scripts.Render("~/bundles/jqueryval") to validate the fields.

Here is the simple code in partialview:

@model Projeto.Models.ModeloModels
@using (Ajax.BeginForm("Ação", "Controller", new AjaxOptions{ OnSuccess = "OnSuccess"}))
    {
       @Html.AntiForgeryToken()
       @Html.ValidationSummary(true, "", new { @class = "text-danger" })
        ...
    }
@Scripts.Render("~/bundles/jqueryval")

When removing line: @Scripts.Render("~/bundles/jqueryval") the warning disappears. Someone knows what this problem might be ?

1 answer

0

I solved the problem differently.

Removing the line :@Scripts.Render("~/bundles/jqueryval").

And add this code in javascript:

<script type="text/javascript">
    $("form").removeData("validator");
    $("form").removeData("unobtrusiveValidation");
    $.validator.unobtrusive.parse("form");
</script>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.