1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

オートコンプリート 候補が絞られない(autocomplete jQuery UI ajax)

Last updated at Posted at 2019-10-08

図のように候補が絞られません。すべて出てきます。ご教授いただけませんでしょうか。推測、じゃないの?どんなことでも構いません。よろしくお願いします。

a無題.png

form.html
<div class="col-sm-3 mb-5">
   <input id="検索" type="text" class="form-control" placeholder="検索">
</div>
<script>
$("#検索").autocomplete({
minLength: 1,
source: function (request, response) {
$.ajax({
  url: "{% url  'search_ajax' %}",      
  dataType: "json",
  type: "POST",
  success: function (data) {
                  data=JSON.parse(data);           
                  response($.map(data, function (obj) {              
                  return {
                          label: obj.顧客__姓,
                           value: obj.顧客__姓,
                  };
   }));
   }
</script>
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?