Postcode search doesn't work in facebook postcode search

34 Views Asked by At

If you go to this site for the example `

website

i have 2 forms one is on the page (which i want to remove) the other im using facebox to bring it up when they click on orange button. The issue is the postcode search only works on the form on the page. I'm not sure why this is or how to get it working any ideas?

using http://defunkt.io/facebox/ script to search for the postcode

      $("#swSearch").autocomplete({
    minLength: 1,
    source: function(req, add){
        $.ajax({
            url: 'http://www.vestedutility.com.au/wms/index.php/welcome/sw_search', //Controller where search is performed
            dataType: 'json',
            type: 'POST',
            data: req,
            success: function(data){
                if(data.response =='true'){
                   add(data.message);
                }
            }
        });
    }
});

  </script>
1

There are 1 best solutions below

0
Wrest On

What i came up with

 <script type="text/javascript">
        jQuery(document).ready(function($) {
          $('a[rel*=facebox]').facebox(); 
          $(document).bind('reveal.facebox', function(){
                $("[name=postal]").each(function(){ 
                    var sws=$(this);
                    if(sws.attr('data-advs')!='1') sws.attr('data-advs', '1').autocomplete({
                        minLength: 1,
                        source: function(req, add){
                            $.ajax({
                                url: 'http://www.vestedutility.com.au/wms/index.php/welcome/sw_search', //Controller where search is performed
                                dataType: 'json',
                                type: 'POST',
                                data: req,
                                success: function(data){
                                    if(data.response =='true'){
                                       add(data.message);
                                    }
                                }
                            });
                        }
                    });
                });
          });
          <?php if(!empty($_SESSION['action_info'])){ ?>$('#backface').click();<?php  session_unset(); } ?>
        })
    </script>