knockout.js IE中的 AJAX 调用出现“预期冒号”javascript错误

o2rvlv0m  于 2022-11-10  发布在  Java
关注(0)|答案(1)|浏览(137)

我正在使用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.");
        }
    })
}
5sxhfpxr

5sxhfpxr1#

速记对象属性(例如: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 },

相关问题