Problem with Auto complete UI it does not auto hide!

Problem with Auto complete UI it does not auto hide!

Hi Guys 
so i set up the auto complete UI on my site but i am having a bit of an issue. when the begining of the string is found then it display results no problem. But if you contuniue typing and no results found it does not close the auto complete menu.

for example 
Mike Jones << is a record in the database.

if I type Mik "Mike Jones" come up which is cool.
but if I type MikZ "Mike Jones also comes up which it should come up until I type the last letter "Z" then it should hide the results.

in my query i am doing something like this WHERE name LIKE $term


here is my jQuery code
I will appreciate your help :)




  1. $(function() {

  2. $( "#fullName" ).autocomplete({
  3. source: function( request, response ) {
  4. $.ajax({
  5. url: "auto.php",
  6. dataType: "json",
  7. data: {
  8. search_term: request.term
  9. },
  10. success: function( data ) {
  11. response( $.map( data, function( item ) {
  12. return {
  13. label: item.name,
  14. name: item.name,
  15. year: item.year,
  16. address: item.address,
  17. id: item.ID,
  18. dID: item.dID,
  19. issue: item.idIssue,
  20. idexp: item.idExp,
  21. phone: item.phone,
  22. cusID: item.cusID
  23. }
  24. }));
  25. }
  26. });
  27. },
  28. minLength: 2,
  29. select: function (event, ui) {


  30. $('#customerID').val(ui.item.cusID);
  31. $('#ID').val(ui.item.id);
  32. $('#dID').val(ui.item.dID);
  33. $('#IDissue').val(ui.item.issue);
  34. $('#IDexp').val(ui.item.idexp);
  35. $('#birthYear').val(ui.item.year);
  36. $('#phoneNum').val(ui.item.phone);
  37. $('#homeAddress').val(ui.item.address);

  38. },
  39. open: function() {
  40. $( this ).removeClass( "ui-corner-all" ).addClass( "ui-corner-top" );
  41. },
  42. close: function() {
  43. $( this ).removeClass( "ui-corner-top" ).addClass( "ui-corner-all" );
  44. }
  45. });
  46. });