"colon expected" javascript 在 IE 中调用 ajax 时出错
"colon expected" javascript error on ajax call in IE
我正在使用 Knockout JS 并使用以下方法进行 ajax 调用。最近我注意到一个控制台错误 Expected ':'
,发生在 Internet Explorer 11 上。这在 Chrome 中工作正常。有没有 IE 无法正确处理的问题?
app.getAutoGeneratedSubmissionAttachments = function (carrierId, employerId, formId, submissionTypeId, IsMedical, IsDental, IsLife, IsVision, callBack) {
$.ajax({
url: $('#GetAutoGeneratedSubmissionAttachments').data('url'),
type: 'GET',
dataType: 'json',
data: { IsMedical, IsDental, IsVision, IsLife, carrierId: carrierId, employerId: employerId, formId: formId, submissionTypeId: submissionTypeId },
success: function (data) {
callBack(data);
},
fail: function (data) {
$.unblockUI();
toastr.error("An error has occured on the server when retrieving additional submission documents.");
}
})
}
Shorthand 对象属性(例如:let o = {a, b, c}
)是 ES6 特性,IE11 不支持
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Object_initializer
https://caniuse.com/#search=es6
要修复它,请更改您的数据以使用标准 key: value
表示法。
data: { IsMedical: IsMedical, IsDental: IsDental, IsVision: IsVision, IsLife: IsLife, carrierId: carrierId, employerId: employerId, formId: formId, submissionTypeId: submissionTypeId },
我正在使用 Knockout JS 并使用以下方法进行 ajax 调用。最近我注意到一个控制台错误 Expected ':'
,发生在 Internet Explorer 11 上。这在 Chrome 中工作正常。有没有 IE 无法正确处理的问题?
app.getAutoGeneratedSubmissionAttachments = function (carrierId, employerId, formId, submissionTypeId, IsMedical, IsDental, IsLife, IsVision, callBack) {
$.ajax({
url: $('#GetAutoGeneratedSubmissionAttachments').data('url'),
type: 'GET',
dataType: 'json',
data: { IsMedical, IsDental, IsVision, IsLife, carrierId: carrierId, employerId: employerId, formId: formId, submissionTypeId: submissionTypeId },
success: function (data) {
callBack(data);
},
fail: function (data) {
$.unblockUI();
toastr.error("An error has occured on the server when retrieving additional submission documents.");
}
})
}
Shorthand 对象属性(例如:let o = {a, b, c}
)是 ES6 特性,IE11 不支持
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Object_initializer
https://caniuse.com/#search=es6
要修复它,请更改您的数据以使用标准 key: value
表示法。
data: { IsMedical: IsMedical, IsDental: IsDental, IsVision: IsVision, IsLife: IsLife, carrierId: carrierId, employerId: employerId, formId: formId, submissionTypeId: submissionTypeId },