1

質問のタイトルが十分に明確でない場合:

jQuery AutoComplete プラグイン ( jQuery UI 1.8.5 の一部)を使用しています。

提供された CSS/画像には ajax のような進行状況の画像が含まれると思いましたか?

そうでない場合、作成する最も簡単な方法は何ですか?

これは私のオートコンプリートコードです:

$('#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).
   }});

上記のコードのどこで画像を非表示/表示する必要がありますか?

明らかに「選択」のコードの後、画像を非表示にすることができましたが、どこで画像を「表示」できますか?

4

1 に答える 1

3
$('#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).
   }});
于 2010-10-20T06:40:36.813 に答える