gpt4 book ai didi

javascript - If 语句不接受变量值

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

我有这个代码:

meJi = 33;
$.ajax({
type: "POST",
url: mega,
data: string,
beforeSend: function() {
$('#loading').html("<img src='images/loading.gif'/>").fadeIn('fast');
},
complete: function() {
$('#loading').fadeOut('fast');
},
success: function(msg) {
loading_hide();
f = (msg).length;
if (f <= 1250) {
alert("su busqueda no presenta resultados");
code(3);

else {
$("#container").html(msg);
fdemandados();
}
}
});
function code(ig) {
console.log(img);
meJi = ig;
}

$("#select_comprobar3").on('click', function(event) {
tacuba = $("#amazon").val();
ca = "2";
dan = "g";
if (meJi ==3) {
avisobusqueda2 = $("#avisofiltro").html("zzzFiltro activado Busqueda por la palabra: " + tacuba + " - clic para quitar ").fadeIn('slow');
} else {}
if (!tacuba) {
alert("Debe ingresar una palabra");
} else {
lor = tacuba;
var page = "1";
loadData(page, dan, lor);
}
event.stopImmediatePropagation();
return false;
});

问题是这样的:

if (meJi==3) {

我不知道为什么,但 meJi 变量永远不会更改为 3,所以条件总是假设 meJi 是 33。

编辑:我更改了条件部分,但问题仍然存在。

最佳答案

function code(ig){
console.log(img);
meJi = ig;
}

不应该是console.log(ig);吗?你如何拥有它会导致错误(img 未定义),因此 meJi 不会被设置。

关于javascript - If 语句不接受变量值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15932443/

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