title: Populate Multiple Textboxes Using Autocomplete
body: <p>I have a textbox that is popluated using the jquery autocomplete feature. The source of my autocomplete results are gathered via a ASP.NET web service from an XML file. The XML file has a basic structure like this:</p>
  
  <pre><code>&lt;RAIL_INTERSECTIONS&gt;
     &lt;RAIL_INT RR="BNSF" RR_DIV="FED" RR_SUBDIV="MAIN" ADDRESS="6700" STREET="LINCOLN" BRANCH="ALVIN" MILE_POST="146" /&gt;
     ...
  &lt;/RAIL_INTERSECTIONS&gt;
  </code></pre>
  
  <p>The auto-complete pulls the STREET attributes from the file and populates my textbox. </p>
  
  <p>In addition, there are two other textboxes on my form that I would like to auto-populate based on the selection of the value in the auto-complete textbox. Those values are also contained in the XML file--RR and RR_DIV as shown above. Right now, I simply use the following code to call my webservice and get a single value for the street. </p>
  
  <pre><code>$(function () {
      $(".tb").autocomplete({
          source: function (request, response) {
              $.ajax({
                  url: "rail_intersection_info.asmx/GetCrossingLocations",
                  data: "{ 'location': '" + request.term + "' }",
                  dataType: "json",
                  type: "POST",
                  contentType: "application/json; charset=utf-8",
                  dataFilter: function (data) { return data; },
                  success: function (data) {
                      response($.map(data.d, function (item) {
                          return {
                              value: item
                          }
                      }))
                  },
                  error: function (XMLHttpRequest, textStatus, errorThrown) {
                      alert(textStatus);
                  }
              });
          },
          minLength: 2
      });
  });
  </code></pre>
  
  <p>My abbreviated web service looks something like this:</p>
  
  <pre><code>List&lt;string&gt; streets = new List&lt;string&gt;();
  
  XmlDocument xmlDocument = new XmlDocument();
  xmlDocument.Load(Server.MapPath(XmlCrossingFile));
  
  XmlNodeList xmlNodeList = xmlDocument.GetElementsByTagName("RAIL_INT");
  for (int i = 0; i &lt; xmlNodeList.Count; i++ )
  {
      streets.Add(xmlNodeList[i].Attributes["STREET"].Value);
  }
  
  var data = streets.Where(m =&gt; m.ToLower().StartsWith(location.ToLower()));
  
  return data.ToList();
  </code></pre>
  
  <p>My question is, how can I return multiple values from my web service and auto-popluate the other textboxes based on the selected value of the first textbox?</p>