在IE11中,此错误是否有任何解决方法。提供的代码在其他浏览器和Edge上也能正常工作,因此我希望在这里找到一种解决方法/解决方案:
document.addEventListener('wpcf7mailsent', function(event) {
var inputs = event.detail.inputs;
if ('2425' == event.detail.contactFormId) {
console.log('Test Click');
var username = document.getElementById('username').value;
var password = document.getElementById('password').value;
form_data = {
username: username,
password: password
}
$.ajax({
url: url,
type: 'POST',
data: JSON.stringify(form_data),
contentType: 'application/json; charset=utf-8',
dataType: 'json',
success: function(response) {
console.log(response);
localStorage.setItem("api_keyF", response.api_key);
localStorage.setItem("is_trial", response.is_trial);
for (i = 0; i < response.user_privileges.length; i++) {
var service_type_id = response.user_privileges[i].service_type_id;
localStorage.setItem("serviceid" + service_type_id, service_type_id);
}
/**alert(response.api_key + ' ' + response.user_privileges{service_type_id});*/
window.location.href = "login-services/";
},
error: function(response) {
console.log(response.responseJSON.message);
// var message = '<div class="alert alert-content-danger row">';
// toastr.error(response.responseJSON.message);
// $('#username').addClass('error-border');
// $('#password').addClass('error-border');
// $('.username').text(response.responseJSON.message);
// $('.password').text(response.responseJSON.message);
// document.getElementById("displayerror").style.display = "block";
// document.getElementById("loginban").style.display = "block";
// document.getElementById('displayerror').innerHTML = response.responseJSON.message;
errorsoftlock = response.responseJSON.message;
if (errorsoftlock == "Your account is locked. Please wait for 5 minutes.") {
document.getElementById("displayerror").style.display = "block";
document.getElementById("loginban").style.display = "block";
document.getElementById('displayerror').innerHTML = "Oops! Your account has been temporarily locked. Please wait for 5 minutes before trying again.";
} else {
document.getElementById("displayerror").style.display = "block";
document.getElementById("loginban").style.display = "block";
document.getElementById('displayerror').innerHTML = response.responseJSON.message;
}
// $('.testerror').html(response.responsetesterrorJSON.message);
//document.getElementsByClassName("testerror").innerHTML = response.responseJSON.message;
}
});
}
}, false);
预期的行为是,一旦我单击按钮,它将进行api调用并将我重定向到主页。对于除IE11以外的浏览器来说都是如此。在IE11中,我可以单击按钮,但是什么也没有发生。我也尝试使用 attachEvent()阅读有关可能的解决方法的信息,但这并不奏效。希望找到可能解决此问题的方法。