场景:
- 自己滚动的 jQuery Ajax 帖子来验证 unfocus 上的输入字段
- 用于在表单上发帖的标准提交按钮
如果我触发验证并等到我在 firebug 中看到它完成,然后单击全部保存就可以了。但是,如果我在字段中进行更改,然后直接单击提交按钮(因此 ajax 和标准发布几乎同时发生)请求在返回“连接重置”之前卡在浏览器中。如果在 VS 调试中运行,除非我暂停,否则我什么也看不到。然后我会看到以下调用堆栈:
System.Web.dll!System.Web.Hosting.IIS7WorkerRequest.ReadEntityCoreSync(byte[] buffer, int offset, int size) + 0x23 bytes<br/> System.Web.dll!System.Web.Hosting.IIS7WorkerRequest.ReadEntityBody(byte[] buffer, int size) + 0x18 bytes<br/> System.Web.dll!System.Web.HttpRequest.GetEntireRawContent() + 0x2d4 bytes<br/> System.Web.dll!System.Web.HttpRequest.GetMultipartContent() + 0x45 bytes<br/> System.Web.dll!System.Web.HttpRequest.FillInFormCollection() + 0xad bytes<br/> System.Web.dll!System.Web.HttpRequest.Form.get() + 0x45 bytes<br/> System.Web.dll!System.Web.HttpRequest.HasForm.get() + 0x46 bytes<br/> System.Web.dll!System.Web.UI.Page.GetCollectionBasedOnMethod(bool dontReturnNull) + 0x62 bytes
背景:
ASP.NET 4 MVC 2 Web 应用程序和一些遗留的 webforms 页面(ajax post 和标准 post 中涉及的页面是同一个 webforms 页面)在 Win7/IIS7 上本地运行。
我可能会在 ajax 验证触发时禁用提交按钮。然而,即使我这样做了,我也很想知道是什么导致了这个看似基于时间/并发的请求问题。
请您参考如下方法:
当点击发生时,你能禁用 ajax post 吗? 这样,您必须在执行任何其他操作之前检查点击事件中的条件。
