0

My generic handler is not being called when using autocomplete,

I have this in my .aspx page.

 $(document).ready(function () {
     $("#test").autocomplete("Handlers/MyHandler.ashx");
 }

with this files included jquery-1.4.2.min.js and jquery-ui-1.8.custom.min.js

I put a breakpoint on server never is reached, also used firebug to see if jquery is making its request and nothing, could be a bug with the plugin?

Sadegh
  • 865
  • 1
  • 23
  • 47
k-dev
  • 1,657
  • 19
  • 30

1 Answers1

3

You are not initializing the jQuery ui autocomplete properly, pass a object with a source property:

$(document).ready(function () {
     $("#test").autocomplete({source: "Handlers/MyHandler.ashx"});
 }

Passing a string directly is used to access one of its methods, for example:

$("#test").autocomplete("enable");
The Scrum Meister
  • 29,681
  • 8
  • 66
  • 64
  • @the-scrum-meister thanks that works!! BTW do you know how to pass a key value pair as result to the autocomplete. – k-dev Feb 13 '11 at 04:31
  • 1
    @user468526 The autocomplete accepts `label` and `value` property, I would suggest looking into a Json formatted for .net. – The Scrum Meister Feb 13 '11 at 04:36