Autocomplete with JSONP problems

3 posts, 0 answers
  1. Stan
    Stan avatar
    13 posts
    Member since:
    Sep 2012

    Posted 19 Dec 2012 Link to this post

    I was trying to follow the instructions here: http://docs.kendoui.com/getting-started/web/autocomplete/overview#using-the-kendo-ui-web-datasource-to-bind-to-jsonp ut I am not seeming to get this to work.  When I am looking at the console, the GET request is going out just fine, I just get nothing back.  If I type the url into my browser, it works fine. I am trying to get JSON back (JSONP since it is not the same url) - what am I doing wrong?

    Here is my js:
    $('#ManufacturerConfirmationId').kendoAutoComplete({
        minLength: 3,
        dataTextField: "ManufacturerConfirmationId",
        filter: "contains",
        dataSource: new kendo.data.DataSource({
            transport: {
                read: {
                    url: serviceBase + 'EquipmentWarranties/ManufacturerConfirmationIdsComplete',
                    data: {
                        manufacturerId: function () { return $('#ManufacturerId').val(); },
                        manufacturerConfirmationId: function () { return $('#ManufacturerConfirmationId').val(); }
                    }
                }
            }
        }),
        change: function () {
            this.dataSource.read();
        }
    });

  2. Stan
    Stan avatar
    13 posts
    Member since:
    Sep 2012

    Posted 20 Dec 2012 Link to this post

    I am very confused, I changed my code a bit.  This code smoewhat works, sends out the right request and fiddler returns with the json, but nothing pops up in my Firebug or the autocomplete:

    manufacturerConfirmationId.kendoAutoComplete({
        minLength: 1,
        dataSource: {
            type: "jsonp",
            transport: {
                read: {
                    url: serviceBase + 'EquipmentWarranties/ManufacturerConfirmationIdsComplete',
                    data: { manufacturerId: "2",  manufacturerConfirmationId: "64" }
                }
            }
        }
    });


    FireBug: http://i.imgur.com/eoEzp.png

    Any idea what I am doing wrong?

  3. Kendo UI is VS 2017 Ready
  4. Alexander Valchev
    Admin
    Alexander Valchev avatar
    2875 posts

    Posted 21 Dec 2012 Link to this post

    Hi Stan,

    Regarding the implementation presented at the first post, please do not call dataSource.read() at the change function of the DataSource. The autoComplete widget will maintain its DataSource out of the box. We will also update the code snippet sample in short terms.

    Regarding your second post, jsonp should be set as a dataType of the read request. Please try the suggested change and let me know if the problem still persists.

    Kind regards,
    Alexander Valchev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top