Reputation: 306
I'm having some problems with jQuery while loading an external page to get some data from mysql. The return var in the function loaded have the right data, but I am assuming it should be in the "d" variable, but it's empty.
This is the way I call the load() to the PHP script.
$("#msj_presupuesto").load("../Content/Scripts/ajax_circulares.php?accion=comprobar_presupuesto",{presupuesto:presupuesto},
function(d){ ... }
Upvotes: 0
Views: 205
Reputation: 306
This is the whole js function:
$("#presupuesto_inicial").focusin(function(){
$("#msj_presupuesto:visible").fadeOut();
}).live("change",function(){
var presupuesto = $(this).attr("value");
$("#msj_presupuesto").hide();
$("#msj_presupuesto").load("../Content/Scripts/ajax_circulares.php?accion=comprobar_presupuesto",{presupuesto:presupuesto},
function(d){
$(this).html("");
if(parseInt(d) == 0){
$(this).html("<img src=\"../Content/Images/icono_ok.png\"/> Presupuesto inicial no usado en otra circular").show();
} else {
$(this).html("<img src=\"../Content/Images/icono_error.png\"/> Presupuesto inicial usado en otra circular").show();
alert("Circulares con ese presupuesto: "+d.substr(0,d.length-2));
}
}
);
});
Upvotes: 1