ajax - 如何在 Asp.Net Core 中创建 AJAX 表单

标签 ajax asp.net-core asp.net-ajax

<form data-ajax="true" data-ajax-mode="replace" data-ajax-update="#results" asp-action="CreateCarClient" asp-controller="Account" method="post" enctype="multipart/form-data">

此表格无效

最佳答案

您正在使用 jQuery Unobtrusive AJAX在 ASP.NET Core 中。您需要使用 npm install jquery.unobtrusive-ajax 将 jquery.unobtrusive-ajax 包安装到您的项目中并在您的 View 中添加对它的引用。

查看 Razor 页面教程here .

This link显示了我如何逐步使用代码的示例。

关于ajax - 如何在 Asp.Net Core 中创建 AJAX 表单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53229656/

相关文章:

ajax - 如何从 did() 中调用 jquery .ajax 获取 JSON 结果?

javascript - 根据 AJAX 请求触发 Greasemonkey 脚本

asp.net-mvc - 无法在 Asp.net core Action 中取消任务

asp.net - 授权与 Active Directory .NET Core 1.1、.Net Framework 的属性交互

asp.net - 如何增加 ASP.NET Ajax PageMethod 的超时时间?

javascript - 为什么这个相等性检查在 Ajax 成功回调中不起作用?

asp.net-web-api - ASP.NET Core WebAPI 404 错误

asp.net-mvc - 当 ModelState 无效时调用 Ajax.BeginForm OnFailure

c# - asp.net url 路由器与 ajax webservice 路径冲突

jquery - 你使用 Ajax JSON 还是 HTML?