I need help with Ajax and PHP

I need help with Ajax and PHP

Hi all, i'm completely new to Ajax and Jquery, I'm trying to detect the result from an ajax request on a php file and perform different events based on the result... for example

//PHP Script Code

if(example = a){
      echo 'example is a';
}else{
      echo 'example is b';
}

then on the success function of the ajax code, i need a code to detect which of the result is retrieved so that i can act differently on each result.. Like for example;

 if the result is 'example is a'... i'll like to close the div and tell the user his request was successful but if the result is 'example is b'.... echo some errors and leave the div open for some corrections

Please can anyone help? Thanks a lot