Jquery with Yii

Hello,

I am new to yii. I am getting confused that is it possible to run both If and else block at a time? I am getting variable result with value=1 and it is object when submitting a form. I have set breakpoints for if and else both. But both block is executed. How it possible?

if(typeof data.result != ‘undefined’ && data.result==1){

            	$('#cruise_sale_pop_box').hide();


            	$('#cruise_sale_pop_box2').show();


        	}else{


            	for(var i in data){


                	$('#cruise_sale_pop_box div.error_message').append('<li>'+data[i]+'</li>');


            	}


        	}

It would be possible if your code is being executed multiple times, with the value of data.result changing.