Getting the error in the autocomplete function of the jquery "this.source is not a function."

My code is :

        $.ajax({
            type: "GET",
            url: "https://url.com",
            dataType: "json",
            success: function (data) {

                //$("#id").autocomplete({ source: response });
                $("#search").autocomplete(
           {
               source: data,
               select: function (event, ui) {
                   $("#search").val(ui.item.FirstName + " / " + ui.item.LastName);
                   return false;
               }
           }).data("autocomplete")._renderItem = function (ul, item) {
               return $("<li></li>")
                   .data("item.autocomplete", item)
                   .append("<a><strong>" + item.FirstName + "</strong> / " + item.LastName + "</a>")
                   .appendTo(ul);
           };
            }
        });

The data in the url is of the form
{{Data: Array[22], Id: null, Result: Object}

I want to use the FirstName and LastName of the Array which is of the form

{FirstNam:R , LAstName:e , Id:9 },{FirstNam:R , LAstName:e , Id:9},...

I tried this also

$.getJSON("https://url.com", function (json) {
                console.log(json);    

            });

But this also gives the same error.

Any help ??


Source: json

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.