jQuery UI Autocomplete-進行状況指標を実装する方法は?
-
09-10-2019 - |
質問
質問のタイトルが十分に明確ではなかった場合:
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).
}});
上記のコードの画像をどこに非表示/表示すればよいですか?
明らかに「select」のコードの後、画像を隠すことができますが、どこに「表示できますか」画像を表示できますか?
解決
$('#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).
}});
所属していません StackOverflow