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
So the WebService is running OK.
Then I tried to run this Jquery code:
- $(function () {
- function log(message) {
- $("<div>").text(message).prependTo("#log");
- $("#log").scrollTop(0);
- }
- $("#PostalCode").autocomplete({
- source: function (request, response) {
- var list = [];
- $.ajax({
- url: "http://www-dev5-net/_layouts/GasConnectivity/AddressCache.asmx/GetPostalCodes",
- dataType: "xml",
- data: {
- prefixText: request.term,
- count: "10"
- },
- success: function (xmlResponse) {
- list = $("ArrayOfString", xmlResponse).map(function () {
- return {
- value: $("string", this).text(),
- label: $("string", this).text()
- };
- }).get();
- }
- });
- response(list);
- },
- minLength: 2,
- select: function (event, ui) {
- log(ui.item ?
- "Selected: " + ui.item.value + " aka " + ui.item.id :
- "Nothing selected, input was " + this.value);
- }
- });
- });
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