Jquery Mobile autocomplete using remote source
I have an existing autocomplete code for Desktop computer using remote php source.
My HTML is
- <!-- Custom Begin Date Render -->
- <input type="text" name="firstinput" id="firstInput" size="9" >
- <!-- Custom End Date Render -->
- <input type="text" name="secondinput" id="secodenInput" size="9" readonly="readonly" />
Javascript
- var countryValue=$('#country').val();
- var stateValue=$('#state').val();
- var cityValue=$('#city').val();
-
- $("#firstinput").autocomplete({
- source: "zipfinder.autocomplete.php?country=" + countryValue+"&state="+stateValue+"&city=" + cityValue,
- minLength: 2,
- select: function(event, ui) {
- $('#secondinput').val(ui.item.secondinput);
- }
- });
When I type they query looks like this
- http://localhost/zipfinder.autocomplete.php?country=uk&state=england&city=london&term=bak
When I type a list appears and if I select anything on the list the zip code gets populated automatically in secodenInput.
The query has been performed by using mysql and php which returns json like
- [{"value":"Baker Street ","secondinput":"W1U"}]
If I require the similar effect as Desktop for mobile, how should I do it?