title: Can someone look at my JqueryUI Autocomplete code and advise where I am going wrong?
body: <p>I am struggling a bit with the following Autocomplete function.</p>
  
  <p>If I debug the MyMethod I can see it is bringing back the correct data there seems to be something wrong with the Jquery autocomplete. There seems to be something wrong with the response part handling the returned data.</p>
  
  <p>Im not sure what response<code>($.map(data.d, function(item)</code> does exactly and also if it should be <code>data</code> or <code>data.d</code></p>
  
  <p>Help would be appreciated. Thanks    </p>
  
  <pre><code>$(document).ready(function() {
          $("[id$='_txtStandard']").autocomplete({
              source: function(request, response) {
                  $.ajax({
                      type: "POST",
                      contentType: "application/json; charset=utf-8",
                      url: "MyPage.aspx/MyMethod",
                      data: '{"MyParam":"' + request.term + '"}',
                      dataType: "json",
                      success: function(data) {
                          response($.map(data.d, function(item) {
                              return {
                                  ID: item.ID,
                                  Value: item.Value
                              };
                          }));
                      },
                      error: function(result) { debugger; }
                  });
              },
              minLength: 1
          })
      });
  
  
  public class AutoComplete
      {
          public string ID { get; set; }
          public string Value { get; set; }
      }
  
  
  [WebMethod]
          public static List&lt;AutoComplete&gt; MyMethod(String AccommodationName)
          {
  
  return a list....
  }
  </code></pre>