display multiple column values in single AutoComplete textbox using jquery
<p>I used this javascript for auto complete textbox,</p>

<p>but my requirment is like, I have to get the values from two fields- empid, emp name into single auto complete textbox. Is this possible? If so please let me know the changes which I need to do in the following script.</p>

<pre><code>&lt;script type="text/javascript"&gt;



      Sys.Application.add_load(wireEvents);


      function wireEvents() {



          $(function () {


              var availableTags = GetListItems();


              function GetListItems() {
                  var name = new Array();
                 var index = 0;
                 $().SPServices
              ({
                 operation: "GetListItems",
                  async: false,
                webURL: "Website Url”,
                  listName: "your Listname/List GUID",
                  CAMLQuery: "&lt;Query&gt;&lt;OrderBy&gt;&lt;FieldRef Name='EmpID' Ascending='True' /&gt;&lt;FieldRef Name='EmpName'&lt;/OrderBy&gt;&lt;/Query&gt;",
                  CAMLViewFields: "&lt;ViewFields&gt;&lt;FieldRef Name='EmpID' &lt;/ViewFields&gt;",
                  completefunc: function (xData, Status)
                   {
                      $(xData.responseXML).find("z\\:row,row").each(function () {
                          name[index] = $(this).attr("ows_EmpID");
                          index++;
                      });
                 }
              });
                  return name;
              }
              function split(val) {
                  return val.split(/,/);
              }
              function extractLast(term) {
                  var nonSpaceTerm = split(term).pop().toString();
                  if (/^\s+\S*/.test(nonSpaceTerm)) {
                      nonSpaceTerm = nonSpaceTerm.replace(/\s+/, "");
                  }
                  return split(nonSpaceTerm).pop();

             }
              $("input[name*='txtKeyword']")
              // don't navigate away from the field on tab when selecting an item
                    .bind("keydown", function (event) {
                        if (event.keyCode === $.ui.keyCode.TAB &amp;&amp;
                         $(this).data("autocomplete").menu.active) {
                             event.preventDefault();
                         }
                     })
                     .autocomplete(
           {
                minLength: 0,
                source: function (request, response) {
                   // delegate back to autocomplete, but extract the last term
                    response($.ui.autocomplete.filter(
                      availableTags, extractLast(request.term)));
                },
                focus: function () {
                    // prevent value inserted on focus
                    return false;
                },
                select: function (event, ui) {
                    var terms = split(this.value);
                    // remove the current input
                    terms.pop();
                    // add the selected item
                    terms.push(ui.item.value);
                    // add placeholder to get the comma-and-space at the end
                 terms.push("");
                    this.value = terms.join("");
                  //  this.value += " ";
                    return false;
                }
            });
          });
     }            
        &lt;/script&gt;
</code></pre>
