Search with autocomplete

In this code, this is always redirecting/forwarding to particular page. Could you please help me to navigate to different page on certain condition.
Suppose if the value of $product_array is greater than “200” go to one particular page, otherwise to second page.

$( “#search” ).autocomplete(
{

minLength: 0,
source: <?php echo $product_array;?>,

focus: function( event, ui )
{
$( “#search” ).val( ui.item.label );
return false;
},

select: function( event, ui )
{
$( “#search” ).val( ui.item.label);
$("#hsearch").val( ui.item.value );
var url = ‘<?php echo Yii::app()->params["productURL"]. "'+ ui.item.value +'"."?lang=$lang"; ?>’;
window.location.replace(url);
}

});

Sponsor our Newsletter | Privacy Policy | Terms of Service