Reputation: 1351
I am sure this is an elementary question but I can't get the script below to function more than once. I have trien using .live() and .on() without success either. It works fine once but then ceases to work.
$('.chk_av').click(function(){
var new_user=$('.new_uname').val();
if(new_user=="")
{
return;
}
var data="new_user="+new_user+"&agent_id="+agent_id+"&key=1";
$.ajax({
type:"POST",
url:"admin_includes/change_pwrd.php",
data:data,
success:function(html){
if(html==1)
{
$('.js_alert3').text("Username already in use.").fadeOut(5000);
return;
}
if(html==2)
{
$('.js_alert3').text("Username Free.").fadeOut(5000);
return;
}
}
})//end ajax
});
Upvotes: 0
Views: 224
Reputation: 76
Try this code you missed fadeIn() in above code.
$('.chk_av').click(function(){
var new_user=$('.new_uname').val();
if(new_user=="")
{
return;
}
var data="new_user="+new_user+"&agent_id="+agent_id+"&key=1";
$.ajax({
type:"POST",
url:"admin_includes/change_pwrd.php",
data:data,
success:function(html){
if(html==1)
{
$('.js_alert3').text("Username already in use.").fadeIn().fadeOut(5000);
return;
}
if(html==2)
{
$('.js_alert3').text("Username Free.").fadeIn().fadeOut(5000);
return;
}
}
})//end ajax
});
Upvotes: 1