我有以下函数,该函数在第一次被调用时可以正常工作,但是在第二个函数调用中,只有alert可以正常工作。有谁能帮我解决下三行为何不能在第二,第三等通话中起作用的问题
function loginData(){
var form = $("#signInForm");
$.ajax({
type: 'POST',
url: '/signin/signin',
data: form.serialize(),
success: function(data){
if(data == "Success")
{
location.replace('<?php echo BASE_HREF ?>/profile');
}
else
{ alert("hello");//this alert is coming but next three lines don't get executed second and next all time
$('#msg').text(data);
$('#msg').css('color', 'red');
$('#msg').fadeOut(2000);
}
//$('#msg').text('<?php echo $errormsg[jserr_msg]; ?>');
}
});
}
第一次调用#msg
使用将元素隐藏fadeOut
。如果您希望它在以后的呼叫中再次显示,请显示它:
$('#msg').text(data);
$('#msg').css('color', 'red');
$('#msg').show();
$('#msg').fadeOut(2000);
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句