1

When I use a Semantic UI search with jQuery, I have a some problems:

API: API action used but no url was defined search Object {}

API: No URL specified for api event

My code:

 $('#product_name').keyup(function() {
      if($(this).val().length >= 2) 
      {
          $.getJSON('http://localhost/eval/www/validations/add/' + $(this).val() + '?do=findProducts', function(payload) {
              var content = payload.products;
              $('.ui.search').search({
                  source: content
              });
              console.log('Data: ',content);
          });
      }
  });

In content a had a right data, but with this errors? Can you help me please?

Thanks.

Community
  • 1
  • 1

1 Answers1

2

If you are using semantic ui and want to get data from server side then you should use it as like below.

$('.ui.search')
  .search({
    minCharacters : 2,
    apiSettings: {
      url: 'https://api.github.com/search/repositories?q={query}'
    },
    fields: {
      results : 'items',
      title   : 'name',
      url     : 'html_url'
    }
  })
;

as mentioned on semantic side. You can also control min key input using minCharacters as given above example. it will start search when it gets 2 char input.

No one
  • 1,130
  • 1
  • 11
  • 21