gpt4 book ai didi

javascript - Ajax 未在 IE 中加载

转载 作者:行者123 更新时间:2023-11-29 14:58:40 26 4
gpt4 key购买 nike

这是脚本。它在所有其他浏览器中工作正常,所以我认为这是一个缓存问题但不是真的。我已经敲了几个小时的脑袋,但没有任何效果。

$.ajaxSetup({
cache: false
});

$("#send").live('click', function () {
console.log("AAAAA");
$("#loader").show();
$form = $('#reservationForm');

$inputs = $form.find('input[name^="entry"]'),
serializedData = $('#reservationForm :input[name^="entry"]').serialize();

console.log(serializedData);
serializedData += "&pageNumber=0&backupCache=1&submit=Submit";

// fire off the request to /form.php
$.ajax({
url: "https://docs.google.com/spreadsheet/formResponse?formkey=d",
// url: "https://docs.google.com/spreadsheet/formResponse?formkey=d;ifq",
type: "post",
data: serializedData,
// callback handler that will be called on success
success: function (response, textStatus, jqXHR) {
// log a message to the console
console.log("Hooray, it worked!");
$("#loader").hide();
document.getElementById('error<?php echo"$uname";?>').innerHTML = error;
$("#success").fadeIn();
setTimeout(function () {
$("#success").fadeOut();
}, 5000);
},
// callback handler that will be called on error
error: function (jqXHR, textStatus, errorThrown) {
// log the error to the console
console.log("The following error occured: " + textStatus, errorThrown);
alert('Due to an unknown error, your form was not submitted, please resubmit it or try later.');
},
// callback handler that will be called on completion
// which means, either on success or error
complete: function () {
// enable the inputs
$inputs.removeAttr("disabled");
}
});

// prevent default posting of form
event.preventDefault();

});

最佳答案

在 IE 中打开 Developer Tools(F12 打开)后,console.log 可用。尝试打开它或在您的代码中使用警报。或者使用 try catch;

try{
console.log('worked')
}
catch(err){
}

你可能想检查你的事件变量是否未定义:

event= event || window.event;
event.preventDefault();

关于javascript - Ajax 未在 IE 中加载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13660327/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com