views:

30

answers:

1

If the question title wasn't clear enough:

I am using the jQuery AutoComplete plugin (part of jQuery UI 1.8.5)

I would have thought the supplied CSS/images would include an ajax-like progress image?

If not, what's the easiest way to create one?

This is my autocomplete code:

$('#query').autocomplete({
   source: function (request, response) {
      $.ajax({
         url: "/Search/FindLocations",
         type: "POST",
         dataType: "json",
         data:
         {
            searchText: request.term
         },
         success: function (data) {
            response($.map(data, function (item) {
               return { name: item.name, value: item.name }
            }))
         }),
   select: function (event, ui) {
      // snip... (this is where i display stuff about what they clicked).
   }});

Where should i hide/show an image in the above code?

Obviously after the code in "select", i could hide an image, but where can i "show" the image?

A: 
$('#query').autocomplete({
   source: function (request, response) {
      //i would show the image here, before starting your ajax request
      $("#theImage").show();
      $.ajax({
         url: "/Search/FindLocations",
         type: "POST",
         dataType: "json",
         data:
         {
            searchText: request.term
         },
         success: function (data) {
            response($.map(data, function (item) {
               return { name: item.name, value: item.name }
            }))
         }),
   select: function (event, ui) {
      // snip... (this is where i display stuff about what they clicked).
   }});
Andy Groff
duh! (slaps head). of course. thanks.
RPM1984