{"id":754,"date":"2014-09-10T09:04:27","date_gmt":"2014-09-10T15:04:27","guid":{"rendered":"http:\/\/behstant.com\/blog\/?p=754"},"modified":"2016-04-26T17:04:31","modified_gmt":"2016-04-26T23:04:31","slug":"search-jquery-ui-ajax-autocomplete-php","status":"publish","type":"post","link":"http:\/\/behstant.com\/blog\/jquery\/search-jquery-ui-ajax-autocomplete-php\/","title":{"rendered":"Search with Ajax and jQuery UI Autocomplete, PHP, MySQL and JSON"},"content":{"rendered":"<figure id=\"attachment_766\" aria-describedby=\"caption-attachment-766\" style=\"width: 290px\" class=\"wp-caption alignright\"><a href=\"https:\/\/behstant.com\/blog\/wp-content\/uploads\/2014\/07\/035.png\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-766 size-medium\" title=\"Autocomplete Example\" src=\"https:\/\/behstant.com\/blog\/wp-content\/uploads\/2014\/07\/035-300x84.png\" alt=\"Autocomplete Example\" width=\"300\" height=\"84\" srcset=\"http:\/\/behstant.com\/blog\/wp-content\/uploads\/2014\/07\/035-300x84.png 300w, http:\/\/behstant.com\/blog\/wp-content\/uploads\/2014\/07\/035.png 418w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-766\" class=\"wp-caption-text\">Autocomplete Example<\/figcaption><\/figure>\n<p style=\"text-align: justify;\">I have been creating posts with scripts to do small stuff, but on this post I would like to show\/teach you how to implement the jQuery UI Autocomplete <a href=\"https:\/\/jqueryui.com\/autocomplete\/\" target=\"_blank\">Widget<\/a>. I have to remark that for the style of the application I am using Bootstrap, so the most important thing is the html code of the form and the Javascript code. This is the Part 1 of the tutorial.<\/p>\n<p>I would like to show you a diagram of the application flow so click it to enlarge.<\/p>\n<figure id=\"attachment_757\" aria-describedby=\"caption-attachment-757\" style=\"width: 390px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/behstant.com\/blog\/wp-content\/uploads\/2014\/07\/034.png\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-757\" title=\"jQuery UI Autocomplete flow\" src=\"http:\/\/behstant.com\/blog\/wp-content\/uploads\/2014\/07\/034-300x180.png\" alt=\"jQuery UI Autocomplete flow\" width=\"400\" height=\"240\" srcset=\"http:\/\/behstant.com\/blog\/wp-content\/uploads\/2014\/07\/034-300x180.png 300w, http:\/\/behstant.com\/blog\/wp-content\/uploads\/2014\/07\/034-1024x617.png 1024w, http:\/\/behstant.com\/blog\/wp-content\/uploads\/2014\/07\/034.png 1802w\" sizes=\"auto, (max-width: 400px) 100vw, 400px\" \/><\/a><figcaption id=\"caption-attachment-757\" class=\"wp-caption-text\">jQuery UI Autocomplete flow<\/figcaption><\/figure>\n<p style=\"text-align: justify;\">As you can see the application will load the information when the page loads, this is why the tutorial is Part 1, on further tutorial the information will not be loaded until the user type the information to search. Now, the code.<\/p>\n<p><!--more--><\/p>\n<h3>THE HTML FORM<\/h3>\n<p style=\"text-align: justify;\">The next code will be the code to for the HTML form. So take notice that the most important part of this code is the Input and where the search information will be typed and the Input where the result of selection information will be place.<\/p>\n<pre class=\"brush: php; gutter: true\">&lt;form class=&quot;form-horizontal&quot; role=&quot;form&quot; method=&quot;get&quot;&gt;\r\n    &lt;div class=&quot;form-group&quot;&gt;\r\n        &lt;label class=&quot;col-sm-2 control-label&quot; for=&quot;name&quot;&gt;Type the name to search&lt;\/label&gt;\r\n        &lt;div class=&quot;input-group col-sm-9&quot;&gt;\r\n            &lt;input id=&quot;name&quot; name=&quot;name&quot; type=&quot;text&quot; class=&quot;form-control&quot; placeholder=&quot;Type the name to search. The information of this field is already loaded.&quot; \/&gt;\r\n        &lt;\/div&gt;\r\n        &lt;div class=&quot;input-group col-sm-9&quot;&gt;\r\n            &lt;br&gt;\r\n            &lt;input id=&quot;id&quot; name=&quot;id&quot; type=&quot;text&quot; class=&quot;form-control&quot; placeholder=&quot;The selected Id will be loaded here.&quot; \/&gt;\r\n        &lt;\/div&gt;\r\n    &lt;\/div&gt;\r\n&lt;\/form&gt;<\/pre>\n<h3>THE AJAX CODE<\/h3>\n<p style=\"text-align: justify;\">This a Ajax code will be use when the page loads, so don\u2019t forget to wrap your jQuery code on the Document ready.<\/p>\n<pre class=\"brush: javascript; gutter: true\">$(document).ready(function(){\r\n\r\n    $.ajax({\r\n        url: &quot;php\/search1.php&quot;,\r\n        dataType: &quot;json&quot;,\r\n        success: function(response){\r\n            \/\/ The mapping code will be here\r\n\r\n            \/\/ The Autocomple code will be here\r\n        }\r\n    });\r\n\r\n});<\/pre>\n<p>This is the meaning of the jQuery Ajax parameters:<\/p>\n<div class=\"quote\">\n<ul>\n<li><strong>URL:<\/strong> This is the path where the data will be sent. Also this script will query the database and return a response.<\/li>\n<li><strong>DATATYPE:<\/strong> With this parameter we are specifying the data that we are expecting to receive.<\/li>\n<li><strong>SUCCESS:<\/strong> A callback function that will be trigger when the request is successfully completed.<\/li>\n<\/ul>\n<\/div>\n<h2>URL<\/h2>\n<p>We are going to make a query to the database to search all the employees. Our file search1.php have all this logic.<\/p>\n<h3>search1.php<\/h3>\n<pre class=\"brush: php; gutter: true\">&lt;?php\r\n    require_once &#039;Connection.simple.php&#039;;\r\n    $conn = dbConnect();\r\n    $OK = true;    \r\n    $data = trim($_GET[&#039;id&#039;]);\r\n    $sql = &#039;SELECT * FROM employee&#039;;\r\n    $stmt = $conn-&gt;prepare($sql);\r\n    $results = $stmt-&gt;execute(array($data));\r\n    $row = $stmt-&gt;fetchAll();\r\n    $error = $stmt-&gt;errorInfo();    \r\n    echo json_encode($row);\r\n?&gt;<\/pre>\n<p>This file has 3 sections:<\/p>\n<ol>\n<li>Connect to the Database.<\/li>\n<li>Query the information.<\/li>\n<li>Convert the information retrieved into JSON with the json_encode() function \u00a0and echo it.<\/li>\n<\/ol>\n<h2>The JavaScript Part<\/h2>\n<p style=\"text-align: justify;\">We are going to split the success function into 2 parts. The first part will parse the information retrieve from the database and store it into an array, this array will be use to fill the Autocomplete. The second part will use the array previously created and create the Autocomplete with the ID and the value.<\/p>\n<h3><strong>1) \u00a0Mapping code.<\/strong><\/h3>\n<pre class=\"brush: javascript; gutter: true\">var data = $(response).map(function(){\r\n\treturn {value: this.name, id: this.employee_id};\r\n}).get();<\/pre>\n<p>This part is a little bit tricky. We use two jQuery functions: map() and get().<\/p>\n<h2>map()<\/h2>\n<p style=\"text-align: justify;\">Per jQuery site this is the description of the function: Pass each element in the current matched set through a function, producing a new jQuery object containing the return values.<\/p>\n<p style=\"text-align: justify;\">The first time I read this definition I had my eyes spinning, I understand this function only by using it. In our example the file search1.php will return a JSON file, so with the map() function we can loop through each element and retrieve the ID and the value.<\/p>\n<h2>get()<\/h2>\n<p style=\"text-align: justify;\">Per jQuery site this is the description of the function: Retrieve one of the elements matched by the jQuery object.<\/p>\n<p style=\"text-align: justify;\">In our example what we get is the object created by map on each return, thus we will have an array created with the information of our JSON. Each element on the array has the name and the ID.<\/p>\n<h3>2) Autocomplete Code.<\/h3>\n<pre class=\"brush: javascript; gutter: true\">$(&#039;#name&#039;).autocomplete({\r\n\tsource: data,\r\n\tminLength: 0,\r\n\tselect: function(event,ui){\r\n\t\t$(&#039;input#id&#039;).val(ui.item.id);\r\n\t}\r\n});<\/pre>\n<p>With the jQuery Autocomplete were are going to use this two function:<\/p>\n<div class=\"quote\">\n<ul>\n<li><strong>SOURCE<\/strong>: This is where the information is located, for our example that source of data was created with the map() and get() functions.<\/li>\n<li><strong>MINLENGTH<\/strong>: Minimum data to be typed in order to trigger the Autocomplete.<\/li>\n<li><strong>SELECT<\/strong>: This is trigger when the user selects a value from the dropdown list of the Autocomplete.\u00a0We are going to assign the value from the name to an input, either you can have visible this field or hide it. In our example we are not submitting any data, but you can use this in your projects. You can also store that value in a variable for future references.<\/li>\n<\/ul>\n<\/div>\n<h2>This is our final JavaScript-jQuery code:<\/h2>\n<pre class=\"brush: javascript; gutter: true\">$(document).ready(function(){\r\n\r\n    $.ajax({\r\n        url: &quot;php\/search1.php&quot;,\r\n        data: {id: 1},\r\n        dataType: &quot;json&quot;,\r\n        success: function(response){\r\n            var data = $(response).map(function(){\r\n                return {value: this.name, id: this.employee_id};\r\n            }).get();\r\n\r\n            $(&#039;#name&#039;).autocomplete({\r\n                source: data,\r\n                minLength: 0,\r\n                select: function(event,ui){\r\n                    $(&#039;input#id&#039;).val(ui.item.id);\r\n                }\r\n            });\r\n        }\r\n    });\r\n\r\n});<\/pre>\n<p>As you can see is not complicated. We just need to push the right buttons. This is just an example of many stuff that you can do with jQuery and the UI suite.<\/p>\n<h3>Buy\u00a0the full code to support the developer with full code explanation(Recommended for beginners)<\/h3>\n\t<form id=\"edd_purchase_944\" class=\"edd_download_purchase_form edd_purchase_944\" method=\"post\">\n\n\t\t\t<div class=\"edd_price_options edd_single_mode\" >\n\t\t<ul>\n\t\t\t<li id=\"edd_price_option_944_supportthedeveloper\"><label for=\"edd_price_option_944_1\"><input type=\"radio\"  checked='checked' name=\"edd_options[price_id][]\" id=\"edd_price_option_944_1\" class=\"edd_price_option_944\" value=\"1\" data-price=\"9.99\"\/>&nbsp;<span class=\"edd_price_option_name\">Support the Developer<\/span><span class=\"edd_price_option_sep\">&nbsp;&ndash;&nbsp;<\/span><span class=\"edd_price_option_price\">&#36;9.99<\/span><\/label><\/li><li id=\"edd_price_option_944_feelinggrateful\"><label for=\"edd_price_option_944_2\"><input type=\"radio\"  name=\"edd_options[price_id][]\" id=\"edd_price_option_944_2\" class=\"edd_price_option_944\" value=\"2\" data-price=\"4.99\"\/>&nbsp;<span class=\"edd_price_option_name\">Feeling Grateful<\/span><span class=\"edd_price_option_sep\">&nbsp;&ndash;&nbsp;<\/span><span class=\"edd_price_option_price\">&#36;4.99<\/span><\/label><\/li><li id=\"edd_price_option_944_justthecode\"><label for=\"edd_price_option_944_3\"><input type=\"radio\"  name=\"edd_options[price_id][]\" id=\"edd_price_option_944_3\" class=\"edd_price_option_944\" value=\"3\" data-price=\"2.99\"\/>&nbsp;<span class=\"edd_price_option_name\">Just the Code<\/span><span class=\"edd_price_option_sep\">&nbsp;&ndash;&nbsp;<\/span><span class=\"edd_price_option_price\">&#36;2.99<\/span><\/label><\/li>\t\t<\/ul>\n\t<\/div><!--end .edd_price_options-->\n\t\n\t\t<div class=\"edd_purchase_submit_wrapper\">\n\t\t\t<button class=\"edd-add-to-cart button-cart edd-submit\" data-nonce=\"953c94ef3d\" data-timestamp=\"1780622443\" data-token=\"d60958af66a146b002b827143f98c7c554896ea278f3b81198a2b2f5c5210687\" data-action=\"edd_add_to_cart\" data-download-id=\"944\"  data-variable-price=\"yes\" data-price-mode=single data-price=\"0.00\" ><span class=\"edd-add-to-cart-label\">(Paypal) Download the Commented Code<\/span> <span class=\"edd-loading\" aria-label=\"Loading\"><\/span><\/button><input type=\"submit\" class=\"edd-add-to-cart edd-no-js button-cart edd-submit\" name=\"edd_purchase_download\" value=\"(Paypal) Download the Commented Code\" data-action=\"edd_add_to_cart\" data-download-id=\"944\"  data-variable-price=\"yes\" data-price-mode=single \/><a href=\"http:\/\/behstant.com\/blog\/checkout\/\" class=\"edd_go_to_checkout button-cart edd-submit\" style=\"display:none;\">Checkout<\/a>\n\t\t\t\t\t\t\t<span class=\"edd-cart-ajax-alert\" aria-live=\"assertive\">\n\t\t\t\t\t<span class=\"edd-cart-added-alert\" style=\"display: none;\">\n\t\t\t\t\t\t<svg class=\"edd-icon edd-icon-check\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"28\" height=\"28\" viewBox=\"0 0 28 28\" aria-hidden=\"true\">\n\t\t\t\t\t\t\t<path d=\"M26.11 8.844c0 .39-.157.78-.44 1.062L12.234 23.344c-.28.28-.672.438-1.062.438s-.78-.156-1.06-.438l-7.782-7.78c-.28-.282-.438-.673-.438-1.063s.156-.78.438-1.06l2.125-2.126c.28-.28.672-.438 1.062-.438s.78.156 1.062.438l4.594 4.61L21.42 5.656c.282-.28.673-.438 1.063-.438s.78.155 1.062.437l2.125 2.125c.28.28.438.672.438 1.062z\"\/>\n\t\t\t\t\t\t<\/svg>\n\t\t\t\t\t\tAdded to cart\t\t\t\t\t<\/span>\n\t\t\t\t<\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div><!--end .edd_purchase_submit_wrapper-->\n\n\t\t<input type=\"hidden\" name=\"download_id\" value=\"944\">\n\t\t\t\t\t\t\t<input type=\"hidden\" name=\"edd_action\" class=\"edd_action_input\" value=\"add_to_cart\">\n\t\t\n\t\t\n\t\t\n\t<\/form><!--end #edd_purchase_944-->\n\t\n<h3><\/h3>\n","protected":false},"excerpt":{"rendered":"<p>I have been creating posts with scripts to do small stuff, but on this post I would like to show\/teach you how to implement the jQuery UI Autocomplete Widget. I have to remark that for the style of the application I am using Bootstrap, so the most important thing is the html code of the &#8230; <a title=\"Search with Ajax and jQuery UI Autocomplete, PHP, MySQL and JSON\" class=\"read-more\" href=\"http:\/\/behstant.com\/blog\/jquery\/search-jquery-ui-ajax-autocomplete-php\/\" aria-label=\"Read more about Search with Ajax and jQuery UI Autocomplete, PHP, MySQL and JSON\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":766,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"footnotes":""},"categories":[25],"tags":[58,68,43,67,62,69],"class_list":["post-754","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-jquery","tag-ajax","tag-database","tag-javascript-2","tag-jquery","tag-php","tag-tutorials"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.2 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Autocomplete tutorial to find a Record with Ajax and jQuery UI<\/title>\n<meta name=\"description\" content=\"On this tutorial we cover the basics to use jQuery UI Autocomplete to find a record on a MySQL database with PHP on the server side. Download code example.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"http:\/\/behstant.com\/blog\/jquery\/search-jquery-ui-ajax-autocomplete-php\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Autocomplete tutorial to find a Record with Ajax and jQuery UI\" \/>\n<meta property=\"og:description\" content=\"On this tutorial we cover the basics to use jQuery UI Autocomplete to find a record on a MySQL database with PHP on the server side. Download code example.\" \/>\n<meta property=\"og:url\" content=\"http:\/\/behstant.com\/blog\/jquery\/search-jquery-ui-ajax-autocomplete-php\/\" \/>\n<meta property=\"og:site_name\" content=\"The Code\" \/>\n<meta property=\"article:published_time\" content=\"2014-09-10T15:04:27+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2016-04-26T23:04:31+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/behstant.com\/blog\/wp-content\/uploads\/2014\/07\/035.png\" \/>\n\t<meta property=\"og:image:width\" content=\"418\" \/>\n\t<meta property=\"og:image:height\" content=\"118\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Reedyseth\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@Reedyseth\" \/>\n<meta name=\"twitter:site\" content=\"@Reedyseth\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Reedyseth\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"http:\/\/behstant.com\/blog\/jquery\/search-jquery-ui-ajax-autocomplete-php\/#article\",\"isPartOf\":{\"@id\":\"http:\/\/behstant.com\/blog\/jquery\/search-jquery-ui-ajax-autocomplete-php\/\"},\"author\":{\"name\":\"Reedyseth\",\"@id\":\"https:\/\/behstant.com\/blog\/#\/schema\/person\/760327e1ee480ad2aabe8e40d784ec9f\"},\"headline\":\"Search with Ajax and jQuery UI Autocomplete, PHP, MySQL and JSON\",\"datePublished\":\"2014-09-10T15:04:27+00:00\",\"dateModified\":\"2016-04-26T23:04:31+00:00\",\"mainEntityOfPage\":{\"@id\":\"http:\/\/behstant.com\/blog\/jquery\/search-jquery-ui-ajax-autocomplete-php\/\"},\"wordCount\":744,\"commentCount\":11,\"image\":{\"@id\":\"http:\/\/behstant.com\/blog\/jquery\/search-jquery-ui-ajax-autocomplete-php\/#primaryimage\"},\"thumbnailUrl\":\"http:\/\/behstant.com\/blog\/wp-content\/uploads\/2014\/07\/035.png\",\"keywords\":[\"Ajax\",\"Database\",\"Javascript\",\"jQuery\",\"PHP\",\"Tutorials\"],\"articleSection\":[\"jQuery\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"http:\/\/behstant.com\/blog\/jquery\/search-jquery-ui-ajax-autocomplete-php\/\",\"url\":\"http:\/\/behstant.com\/blog\/jquery\/search-jquery-ui-ajax-autocomplete-php\/\",\"name\":\"Autocomplete tutorial to find a Record with Ajax and jQuery UI\",\"isPartOf\":{\"@id\":\"https:\/\/behstant.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"http:\/\/behstant.com\/blog\/jquery\/search-jquery-ui-ajax-autocomplete-php\/#primaryimage\"},\"image\":{\"@id\":\"http:\/\/behstant.com\/blog\/jquery\/search-jquery-ui-ajax-autocomplete-php\/#primaryimage\"},\"thumbnailUrl\":\"http:\/\/behstant.com\/blog\/wp-content\/uploads\/2014\/07\/035.png\",\"datePublished\":\"2014-09-10T15:04:27+00:00\",\"dateModified\":\"2016-04-26T23:04:31+00:00\",\"author\":{\"@id\":\"https:\/\/behstant.com\/blog\/#\/schema\/person\/760327e1ee480ad2aabe8e40d784ec9f\"},\"description\":\"On this tutorial we cover the basics to use jQuery UI Autocomplete to find a record on a MySQL database with PHP on the server side. Download code example.\",\"breadcrumb\":{\"@id\":\"http:\/\/behstant.com\/blog\/jquery\/search-jquery-ui-ajax-autocomplete-php\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\/\/behstant.com\/blog\/jquery\/search-jquery-ui-ajax-autocomplete-php\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/behstant.com\/blog\/jquery\/search-jquery-ui-ajax-autocomplete-php\/#primaryimage\",\"url\":\"http:\/\/behstant.com\/blog\/wp-content\/uploads\/2014\/07\/035.png\",\"contentUrl\":\"http:\/\/behstant.com\/blog\/wp-content\/uploads\/2014\/07\/035.png\",\"width\":418,\"height\":118},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\/\/behstant.com\/blog\/jquery\/search-jquery-ui-ajax-autocomplete-php\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/behstant.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Search with Ajax and jQuery UI Autocomplete, PHP, MySQL and JSON\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/behstant.com\/blog\/#website\",\"url\":\"https:\/\/behstant.com\/blog\/\",\"name\":\"The Code\",\"description\":\"Learn Web Solutions in WordPress, PHP, jand also purchase code solutions.\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/behstant.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/behstant.com\/blog\/#\/schema\/person\/760327e1ee480ad2aabe8e40d784ec9f\",\"name\":\"Reedyseth\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/secure.gravatar.com\/avatar\/117af509aa15be89968fe955258a7bf8ed362ec2adf1afcf2af50a976f2349fa?s=96&r=g\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/117af509aa15be89968fe955258a7bf8ed362ec2adf1afcf2af50a976f2349fa?s=96&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/117af509aa15be89968fe955258a7bf8ed362ec2adf1afcf2af50a976f2349fa?s=96&r=g\",\"caption\":\"Reedyseth\"},\"description\":\"My Google Profile+\",\"sameAs\":[\"http:\/\/behstant.com\"],\"url\":\"http:\/\/behstant.com\/blog\/author\/reedyseth\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Autocomplete tutorial to find a Record with Ajax and jQuery UI","description":"On this tutorial we cover the basics to use jQuery UI Autocomplete to find a record on a MySQL database with PHP on the server side. Download code example.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"http:\/\/behstant.com\/blog\/jquery\/search-jquery-ui-ajax-autocomplete-php\/","og_locale":"en_US","og_type":"article","og_title":"Autocomplete tutorial to find a Record with Ajax and jQuery UI","og_description":"On this tutorial we cover the basics to use jQuery UI Autocomplete to find a record on a MySQL database with PHP on the server side. Download code example.","og_url":"http:\/\/behstant.com\/blog\/jquery\/search-jquery-ui-ajax-autocomplete-php\/","og_site_name":"The Code","article_published_time":"2014-09-10T15:04:27+00:00","article_modified_time":"2016-04-26T23:04:31+00:00","og_image":[{"width":418,"height":118,"url":"http:\/\/behstant.com\/blog\/wp-content\/uploads\/2014\/07\/035.png","type":"image\/png"}],"author":"Reedyseth","twitter_card":"summary_large_image","twitter_creator":"@Reedyseth","twitter_site":"@Reedyseth","twitter_misc":{"Written by":"Reedyseth","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"http:\/\/behstant.com\/blog\/jquery\/search-jquery-ui-ajax-autocomplete-php\/#article","isPartOf":{"@id":"http:\/\/behstant.com\/blog\/jquery\/search-jquery-ui-ajax-autocomplete-php\/"},"author":{"name":"Reedyseth","@id":"https:\/\/behstant.com\/blog\/#\/schema\/person\/760327e1ee480ad2aabe8e40d784ec9f"},"headline":"Search with Ajax and jQuery UI Autocomplete, PHP, MySQL and JSON","datePublished":"2014-09-10T15:04:27+00:00","dateModified":"2016-04-26T23:04:31+00:00","mainEntityOfPage":{"@id":"http:\/\/behstant.com\/blog\/jquery\/search-jquery-ui-ajax-autocomplete-php\/"},"wordCount":744,"commentCount":11,"image":{"@id":"http:\/\/behstant.com\/blog\/jquery\/search-jquery-ui-ajax-autocomplete-php\/#primaryimage"},"thumbnailUrl":"http:\/\/behstant.com\/blog\/wp-content\/uploads\/2014\/07\/035.png","keywords":["Ajax","Database","Javascript","jQuery","PHP","Tutorials"],"articleSection":["jQuery"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"http:\/\/behstant.com\/blog\/jquery\/search-jquery-ui-ajax-autocomplete-php\/","url":"http:\/\/behstant.com\/blog\/jquery\/search-jquery-ui-ajax-autocomplete-php\/","name":"Autocomplete tutorial to find a Record with Ajax and jQuery UI","isPartOf":{"@id":"https:\/\/behstant.com\/blog\/#website"},"primaryImageOfPage":{"@id":"http:\/\/behstant.com\/blog\/jquery\/search-jquery-ui-ajax-autocomplete-php\/#primaryimage"},"image":{"@id":"http:\/\/behstant.com\/blog\/jquery\/search-jquery-ui-ajax-autocomplete-php\/#primaryimage"},"thumbnailUrl":"http:\/\/behstant.com\/blog\/wp-content\/uploads\/2014\/07\/035.png","datePublished":"2014-09-10T15:04:27+00:00","dateModified":"2016-04-26T23:04:31+00:00","author":{"@id":"https:\/\/behstant.com\/blog\/#\/schema\/person\/760327e1ee480ad2aabe8e40d784ec9f"},"description":"On this tutorial we cover the basics to use jQuery UI Autocomplete to find a record on a MySQL database with PHP on the server side. Download code example.","breadcrumb":{"@id":"http:\/\/behstant.com\/blog\/jquery\/search-jquery-ui-ajax-autocomplete-php\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["http:\/\/behstant.com\/blog\/jquery\/search-jquery-ui-ajax-autocomplete-php\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/behstant.com\/blog\/jquery\/search-jquery-ui-ajax-autocomplete-php\/#primaryimage","url":"http:\/\/behstant.com\/blog\/wp-content\/uploads\/2014\/07\/035.png","contentUrl":"http:\/\/behstant.com\/blog\/wp-content\/uploads\/2014\/07\/035.png","width":418,"height":118},{"@type":"BreadcrumbList","@id":"http:\/\/behstant.com\/blog\/jquery\/search-jquery-ui-ajax-autocomplete-php\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/behstant.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Search with Ajax and jQuery UI Autocomplete, PHP, MySQL and JSON"}]},{"@type":"WebSite","@id":"https:\/\/behstant.com\/blog\/#website","url":"https:\/\/behstant.com\/blog\/","name":"The Code","description":"Learn Web Solutions in WordPress, PHP, jand also purchase code solutions.","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/behstant.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/behstant.com\/blog\/#\/schema\/person\/760327e1ee480ad2aabe8e40d784ec9f","name":"Reedyseth","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/117af509aa15be89968fe955258a7bf8ed362ec2adf1afcf2af50a976f2349fa?s=96&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/117af509aa15be89968fe955258a7bf8ed362ec2adf1afcf2af50a976f2349fa?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/117af509aa15be89968fe955258a7bf8ed362ec2adf1afcf2af50a976f2349fa?s=96&r=g","caption":"Reedyseth"},"description":"My Google Profile+","sameAs":["http:\/\/behstant.com"],"url":"http:\/\/behstant.com\/blog\/author\/reedyseth\/"}]}},"_links":{"self":[{"href":"http:\/\/behstant.com\/blog\/wp-json\/wp\/v2\/posts\/754","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/behstant.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/behstant.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/behstant.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/behstant.com\/blog\/wp-json\/wp\/v2\/comments?post=754"}],"version-history":[{"count":0,"href":"http:\/\/behstant.com\/blog\/wp-json\/wp\/v2\/posts\/754\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/behstant.com\/blog\/wp-json\/wp\/v2\/media\/766"}],"wp:attachment":[{"href":"http:\/\/behstant.com\/blog\/wp-json\/wp\/v2\/media?parent=754"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/behstant.com\/blog\/wp-json\/wp\/v2\/categories?post=754"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/behstant.com\/blog\/wp-json\/wp\/v2\/tags?post=754"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}