Javascript IE中未定义的内联onclick

Javascript IE中未定义的内联onclick,javascript,internet-explorer,Javascript,Internet Explorer,我正在编辑一个带有onclick属性的锚定标记的站点。该事件调用显示客户订单详细信息的模式。该链接在IE中不起作用。callResendEmailService函数未定义,但这段代码在Chrome和Firefox中也起作用。在IE中工作需要什么 <a onclick="callResendEmailService(orderId);"href="javascript:void(0)">Click here</a> function callResendEmailServ

我正在编辑一个带有onclick属性的锚定标记的站点。该事件调用显示客户订单详细信息的模式。该链接在IE中不起作用。callResendEmailService函数未定义,但这段代码在Chrome和Firefox中也起作用。在IE中工作需要什么

<a onclick="callResendEmailService(orderId);"href="javascript:void(0)">Click here</a>

function callResendEmailService(orderId){
        $.ajax({
            type: "POST",
            data: {orderId },
            dataType:"text",
            url : contextPath+'resendVoucherEmail.htm',
            success: function(dataReturn, textStatus, xhr){
                if(dataReturn=='error'){
                alert("Error in sending email");}
                else{
                showEmailConfirmationOverlay();}
            },
            error : function(jqXHR, textStatus, errorThrown)
            {
               alert("Error in sending email");
            }
        })
    }

函数callResendEmailService(orderId){
$.ajax({
类型:“POST”,
数据:{orderId},
数据类型:“文本”,
url:contextPath+'resendVoucherEmail.htm',
成功:函数(dataReturn、textStatus、xhr){
if(dataReturn=='error'){
警报(“发送电子邮件时出错”);}
否则{
showEmailConfirmationOverlay();}
},
错误:函数(jqXHR、textStatus、errorshown)
{
警报(“发送电子邮件时出错”);
}
})
}
更改:

        data: {orderId },
致:


您使用的语法是Ecmascript 6功能,这在IE中不可用。

尝试将Javascript包装在
中。可能会有帮助。IE是否会引发其他错误?您的代码段使用–
数据:{orderId}
–和(唯一使用的Microsoft浏览器是Edge)。@JaromandaX必须在调用之前定义它,而不必在引用之前定义它。Javascript控制台中是否有任何错误?在IE中会出现错误,因为正如前面的评论所说,您正在使用ES2015+功能<代码>数据:{orderId}
。。。将需要
数据:{orderId:orderId}
才能在IE中成为有效语法。我很惊讶您在加载有关缺少
的页面时没有收到控制台错误:
        data: {orderId: orderId },