I want to show the value in autocomplete.

Refer my code below:

<script src="http://code.jquery.com/ui/1.10.2/jquery-ui.js" ></script>
    $zipdata = array();
    $zipval =array();
        foreach ($storeCollection as $key => $value){ 

            if ($value['latitude']==0 || $value['longitude']==0){

            $zipdata[]  = $value['name'].' '.$value['city'].' '.$value['state_province'].' '.$value['postal_code'];
            $zipval[] =  $value['name'].', '.$value['city'].', '.$value['state_province'];


        if(count($zipdata) > 0){ ?>

                var zipdata = <?php echo json_encode($zipdata); ?> ;
                var zipval = <?php echo json_encode($zipval); ?> ;


        jQuery( "#retailer" ).autocomplete({
        source: zipdata

        <?php } ?>  

   /* $("#retailer").keyup(function(){
        type: "POST",
        url: "Grid.php"
        beforeSend: function(){
        success: function(data){
/*function selectCountry(val) {

But I am not able to achieve it.

Any help would be appreciated

  • what's the problem with it? What is $modelCollection? Where does it come from? – Marius Apr 1 at 7:14
  • The problem is I am not able to autocomplete this input field.. – Amy Apr 1 at 7:15
  • $modelcollection is my custom module, where I am getting the collection to show in this input field. – Amy Apr 1 at 7:17
  • The values are coming through this field, but I am not able to autocomplete it. – Amy Apr 1 at 7:18
  • 1
    maybe you should add that to the question. Maybe show a screenshot with what's happening. – Marius Apr 1 at 7:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.