[Answer]-JQuery ui autocomplete with Django return 404

1👍

I suspect you’re serving the JS file separately. If that’s the case, then you’ll have to:

either write the full URL yourself in the JS file.

source: "/api/get_ticker/",

or copy the script in your HTML template.

<script>
    $(function() {
       $("#ticker").autocomplete({
           source: "{% url 'get_ticker' %}",
           minLength: 2,
       });
   });
</script>
👤xyres

0👍

Try this:

$(function(){
  $('#ticker').autocomplete({
    source: "{% url 'get_ticker' %}",
    minLength: 2,
  });
});
👤Gocht

0👍

Replace:

 "{% url get_ticker %}"

with

 "{% url 'get_ticker' %}"

Make note of the quotes

Leave a comment