jQuery ComboBox

Set the search property of the jqxComboBox. Author: http://jqwidgets.com

by Hristo Hristov

HTML

<link rel="stylesheet" href="http://jqwidgets.com/public/jqwidgets/styles/jqx.base.css">
<link rel="stylesheet" href="http://jqwidgets.com/public/jqwidgets/styles/jqx.energyblue.css">
<script src="http://jqwidgets.com/public/jqwidgets/jqx-all.js"></script>
  <div id='jqxComboBox'></div>

  <input type="text" id="city">

JavaScript

$("#city").autocomplete({
  
	   source: function( request, response ) {
		 $.ajax({
		  url: "http://api.geonames.org",	//"http://ws.geonames.org/searchJSON",
		  dataType: "jsonp",
		  data: {
        featureClass: "P",
        style: "full",
        maxRows: 20,
        name_startsWith: 'Bul'//request.term,
        //country: 'Bulgaria',//$("#country :selected").val(),
        //username: "<hristoTest>"
		  },
		  success: function( data ) {
			response( $.map( data.geonames, function( item ) {
			  return {
			  label: item.name + (item.adminName1 ? ", " + item.adminName1 : ""),
			  value: item.name,
			  str: item.lat+"|"+item.lng+"|"+item.timezone.timeZoneId+"|"+encodeURIComponent(item.name)+"|"+encodeURIComponent(item.adminName1)+"|"+encodeURIComponent(item.countryName)+"|"+encodeURIComponent(item.countryCode)
			  }
			}));
		  }
		 });
		},
	  minLength: 2,
	  select: function( event, ui ) {
		  window.location = "<?php echo $pagename.'?auswahl='; ?>"+ui.item.str;
	  }

	});