我正在开发一个asp.net mvc web应用程序,我有以下主要观点: -
<div class="box-content">
@using (Ajax.BeginForm("AssignCustomer", "Firewall", new AjaxOptions
{
InsertionMode = InsertionMode.InsertAfter,
UpdateTargetId = "Customertable",
LoadingElementId = "progress",
HttpMethod= "POST",
OnSuccess="submitform"
}))
{
@Html.ValidationSummary(true)
@Html.AntiForgeryToken()
@Html.HiddenFor(model=>model.FirewallCustomer.ID)
<div>
<span class="f">Customer Name</span>
@Html.TextBoxFor(model => model.FirewallCustomer.CustomerName, new { data_autocomplete_source = Url.Action("CustomerAutoComplete", "Firewall") })
@Html.ValidationMessageFor(model => model.FirewallCustomer.CustomerName)
</div>
<input type="submit" value="Save" class="btn btn-primary"/>
}
<p><img src="~/Content/Ajax-loader-bar.gif" class="loadingimage" id="progress" /></p>
<table class="table table-striped table-bordered bootstrap-datatable datatable">
<thead>
<tr>
<th class="f"> Customer Name </th>
</tr></thead>
<tbody id="Customertable">
@foreach(var info in Model.Firewall.FirewallCustomers.OrderBy(a=>a.CustomerName)){
<tr id= "@info.CustomerName">
<td> @Html.ActionLink(info.CustomerName, "Index", "Customer", new {searchTerm=info.CustomerName},null)</td>
<td></td>
</tr>
}
</tbody>
</table> </div></div></div>
@section Scripts {
@Scripts.Render("~/bundles/jqueryval")
}
在提交Ajax.begin表单时调用以下操作方法: -
[HttpPost]
[ValidateAntiForgeryToken]
[CheckUserPermissions(Action = "Edit", Model = "Firewall")]
public ActionResult AssignCustomer([Bind(Include = "FirewallCustomer")] FirewallJoin fc)
{
fc.FirewallCustomer.CustomerName = fc.FirewallCustomer.CustomerName.Trim();
if (ModelState.IsValid)
{
try
{
repository.InsertOrUpdateFirewallCustomer(fc.FirewallCustomer,ADusername);
repository.Save();
return View("_customerrow", fc.FirewallCustomer);
和action方法调用返回的部分视图(应该在表体之后插入)如下所示: -
@model TMS.Models.FirewallCustomer
<tr id="@Model.CustomerName.ToString()">
<td>@Model.CustomerName</td>
<td>
@Ajax.ActionLink("Delete",
"DeleteCustomerFirewall", "Firewall",
new { firewallid = Model.ID, customername = Model.CustomerName},
new AjaxOptions
{ Confirm = "Are You sure You want to delete " + Model.CustomerName,
HttpMethod = "Post",
OnSuccess = "deletionconfirmation",
OnFailure = "deletionerror"
})
</td>
</tr>
现在当我点击ajax.beginform insdie我的主视图时,该记录将被添加到数据库中,但部分视图将不会返回,而是我将获得以下异常: -
0x80020101 - JavaScript runtime error: Could not complete the operation due to error 80020101.
jquery 1.8.2将在以下代码中抛出异常(throw e): -
if ( !transport ) {
done( -1, "No Transport" );
} else {
jqXHR.readyState = 1;
// Send global event
if ( fireGlobals ) {
globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
}
// Timeout
if ( s.async && s.timeout > 0 ) {
timeoutTimer = setTimeout( function(){
jqXHR.abort( "timeout" );
}, s.timeout );
}
try {
state = 1;
transport.send( requestHeaders, done );
} catch (e) {
// Propagate exception as error if not done
if ( state < 2 ) {
done( -1, e );
// Simply rethrow otherwise
} else {
throw e;
}
}
任何人都可以认识造成这个问题的原因吗?
答案 0 :(得分:2)
所有错误80020101意味着在评估JavaScript时存在某种错误。如果您通过Ajax加载JavaScript,评估过程就特别严格。
有时删除//会解决问题,但反之则不正确......问题并不总是由//引起。
查看Ajax调用返回的确切JavaScript,并查找该脚本中的任何问题。有关详细信息,请参阅此处的精彩文章
http://mattwhite.me/blog/2010/4/21/tracking-down-error-80020101-in-internet-exploder.html