Reputation: 1345
I have a form which opens in a popup and when I submit values in that after getting success status it will show 1 alert. After alert the pop is still there. I need to close it. My popup box ajax code is here.
$.ajax({
url: ""+baseurl+"user/update_user_details",
async: false,
type: "POST",
dataType: "html",
cache: false,
data: {cli_type:user_type, cli_name:client_name, cli_address:client_address, cli_email:client_email, cli_phone:client_phone, clie_mobile:client_mobile,user_id:usr_id},
success: function(response){
if(response=='success'){
alert('User Details Updated Successfully');
}
}
});
Upvotes: 1
Views: 1273
Reputation:
Check on if(response=='success') line. There may be no response is getting. If there is a response it is the right way.
Upvotes: 2
Reputation: 1345
I have fixed the issue. Used one condition in alert like this.
if(!alert('Details updated succesfully!')){window.location.reload();}
Upvotes: 1