Autocomplete with a asp.net web service

Autocomplete with a asp.net web service

Hi all,

This is my first steps with Jquery UI. I found some code and examples but my code isn't working...

The goal: use the autocomplete with an ASP.NET WebService method (2 parameters)

When I call my Webmethod with parameters: prefixText="50" and count = "10"
I get

  1. <?xml version="1.0" encoding="utf-8" ?>
  2. - <ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="ORES.SharePoint2010.Common">
  3.   <string>5000</string>
  4.   <string>5100</string>
  5.   </ArrayOfString>

So the WebService is running OK.

Then I tried to run this Jquery code:


  1.       $(function () {
  2.           function log(message) {
  3.               $("<div>").text(message).prependTo("#log");
  4.               $("#log").scrollTop(0);
  5.           }

  6.           $("#PostalCode").autocomplete({
  7.               source: function (request, response) {
  8.                   var list = [];
  9.                   $.ajax({
  10.                       url: "http://www-dev5-net/_layouts/GasConnectivity/AddressCache.asmx/GetPostalCodes",
  11.                       dataType: "xml",
  12.                       data: {
  13.                           prefixText: request.term,
  14.                           count: "10"
  15.                       },
  16.                       success: function (xmlResponse) {
  17.                           list = $("ArrayOfString", xmlResponse).map(function () {
  18.                               return {
  19.                                   value: $("string", this).text(),
  20.                                   label: $("string", this).text()
  21.                               };
  22.                           }).get();
  23.                       }
  24.                   });
  25.                   response(list);
  26.               },
  27.               minLength: 2,
  28.               select: function (event, ui) {
  29.                   log(ui.item ?
  30.           "Selected: " + ui.item.value + " aka " + ui.item.id :
  31.           "Nothing selected, input was " + this.value);
  32.               }
  33.           });
  34.           });

Is It the right way to pass 2 parameters into the WebService? (see "data" section)

I tried to debug with FireBug but It looks xmlResponse is empty.

So do-you see any problem with my first jquery code? 
How do-you debug it? FireBug isn't that good...Isn't there a real tool to debug? Like Visual Studio for .NET?


Thanks for you help,

Frenchy