gpt4 book ai didi

internet-explorer - jquery ajax 在 IE 中不起作用

转载 作者:行者123 更新时间:2023-12-01 06:03:25 24 4
gpt4 key购买 nike

我知道这个问题已被问过 b4,但所提供的解决方案似乎都不适合我。我有一个 ajax 函数,它通过 post 发送 id 并相应地提取数据。它在除 IE 之外的所有浏览器中都可以正常工作(所有版本包括 9)。没有显示解析错误或任何其他错误。代码:

         $.ajax({
url: "ajax.php",
error:function(obj,err) {
alert(err);
},
type:"POST",
dataType:'json',
data: "id=" + id,
cache:false,
success: function(data){
console.log(data);
var specs="<div class='float'>";
for (i=0;i<data['specs'].length;i++) {
specs+="<li>" + data['specs'][i] + "</li>";
if ((i+1)%3==0) {
specs+="</div><div class='float'>";
};
};
specs+="</div>";
$("#spec").find("ul").html(specs);
$("#suite_thumbs ul").html(data['thumbs']);
$("#large").attr("src","suites/suite" + data['id'] + "/pic1.jpg");
$("#perks p").html(data['perks']);
$("#suite_text p").html(data['desc']);
$("#treatments p").html(data['treatments']);
$("#arrival p").html(data['arrival']);
$("#recommend p").html(data['recommend']);
$("#suite_thumbs").find("img").click(function(){
current.removeAttr("id");
$(this).attr("id","current_thumb");
current = $("#current_thumb");
var src = $(this).attr("src");
$("#large").attr("src",src);
});
num_pics = data['num_pics'];
video(data['id']); }
});

非常感谢您的帮助。

最佳答案

  1. 您为何将其放入成功响应中:

    $("#suite_thumbs").find("img").click(function(){ current.removeAttr("id"); $(this).attr("id","current_thumb"); 当前 = $("#current_thumb"); var src = $(this).attr("src"); $("#large").attr("src",src);});

  2. 您之前声明过 var *num_pics* 和 var video 吗?

关于internet-explorer - jquery ajax 在 IE 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8970442/

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