gpt4 book ai didi

javascript - 检测加载的页面 - ajax

转载 作者:行者123 更新时间:2023-11-30 08:59:48 25 4
gpt4 key购买 nike

我有这段代码,一些额外的 JS 应该因加载的每个页面而不同。我怎样才能做到这一点?谢谢

  function foo(val) {
$("#paginas").hide("fast").load(('profile' + val + '.php'), function () {

//pseudo code
if (page loaded is profile1)
alert("a");

if (page loaded is profile2)
alert("b");

and so on

});
}
for (var i = 0; i < 8; i++) {
$('.lista' + i).bind('click', {
button: i
}, function (event) {
foo(event.data.button);
});
}

最佳答案

听起来您正在尝试编写 if (val === 2)

关于javascript - 检测加载的页面 - ajax,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10196551/

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