Reputation: 799
I have this code:
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;
});
the problem is this:
if (meJi==3) {
I don't know why but meJi variable never changes to 3 so the conditional always assume that meJi is 33.
edit: Im change the conditional part but the problem still exist.
Upvotes: 1
Views: 129
Reputation: 776
In
function code(ig){
console.log(img);
meJi = ig;
}
Should it not be console.log(ig);
? How you have it would cause an error (with img
not defined) and therefore, meJi would not get set.
Upvotes: 5