Json autocomplete drop down no show?

Can figure how to show the drop down menu with possible results using jquery and json?

My sql =

foreach($sql as $key)
{
		
		$search_arr[] = array("name" => $key['s_name']);
}

echo json_encode($search_arr);
}

exit;

and JQuery:

<script>
$(document).ready(function(){
	$("#search-box").keyup(function(){
		$.ajax({
		type: "POST",
		url: 'http://localhost/testsite/geolocation/',
		data:'search='+$(this).val(),

		
		success: function(data){
			
			$("#suggesstion-box").html(data);
			$("#search-box").css("background","red");
			
		}
		});
	});
});


</script>

I can see json data returned correctly here:

[{"name":"Huelva"}]

Why drop down menu is not showing please teach me how to.

Could it be due to that spelling mistake?

2 Likes

Opppsss that was it :wink: thanks

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.