I have the following code:
$("#forma_mod_uid").livequery( function (){
$("#forma_mod_uid").ajaxForm({
beforeSubmit: mcargando("#cargando2"),
target:'#mod_2',
success: ocargando("#cargando2")
})
});
The mcargando passes the div which will contain a spinner img, and then on success ocragando will hide that div, problem is that beforeSubmit is firing beforeSubmit on document ready.
function mcargando(id_div){
if (id_div==null){ var id_div="#cargando";}
$(id_div).livequery(function (){$(id_div).show();});
}
Should be:
And
Should be:
As you have it right now, you are calling the functions. The only way you could use the code you have there without calling the function is if you did
beforeSubmit: mcargando,but since you need to pass a variable to the function just wrap the call in a function to be able to do it and you should be fine.