title: Typeahead bloodhound prefetch results in internal server error (ASP.NET)
body: <p>I want to dynamically add typeahead to my textboxes in a ASP.NET solution. In my project I have a service, so far a Test-method which should return a list of suggestions from my server. </p>
  
  <pre><code>[WebMethod]
  [ScriptMethod(UseHttpGet = true)]
  public string[] Test()
  {
      var test =  new[] {"Test1", "Test2"};
      return test;
  }
  </code></pre>
  
  <p>I try to call my web method using this javascript code</p>
  
  <pre><code>function addTypeahead(textbox) {
      var bloodHound = new Bloodhound({
          datumTokenizer: function (d) {
              return Bloodhound.tokenizers.whitespace(d.value.toString());
          },
          queryTokenizer: Bloodhound.tokenizers.whitespace,
          prefetch: {
              url: "http://localhost:23135/Service/SomeService.asmx/Test",
              filter: function (items) {
                  return $.map(items, function (item) {
                      return { value: item.value.toString() }
                  });
              },
              ttl: 1000
          },
          storage: textbox
  
      });
      bloodHound.initialize();
  
      $(textbox).typeahead({ highlight: true }, {
          hint: false,
          name: textbox,
          source: bloodHound.ttAdapter()
      });
  }
  </code></pre>
  
  <p>but all I get is a Internal Server Error (500) when trying to retrieve my suggestions. But if I make an ajax call instead I don't get an internal server error. The following code works perfectly fine.</p>
  
  <pre><code>$.ajax({
      type: "GET",
      url: "http://localhost:23135/Service/SomeService.asmx/Test",
      contentType: "application/json; charset=utf-8",
      dataType: "json",
      error: function (xmlHttpRequest, textStatus) {
          alert(textStatus);
      },
      success: function (suggestions) {
          console.log("suggestions:", suggestions);
      }
  });
  </code></pre>
  
  <p>Any reason to why the first javacode snippet doesn't work? </p>