I am using ajax to go the function and check if the value already exist on the database or not. If the data already exist, I show the jQuery dialog which is working fine but if
You can make your answer for example json encoded, where you will return two parameters:
{
success: true/false,
data : YOUR_DATA_HERE
}
So success callback can look into success part, and decide whether to show popup with data, or make page reload
Sorry, I don't know python, so can't advise exact expression to make correct json encode.