Handling JSONP errors

2 posts, 0 answers
  1. Steve
    Steve avatar
    1871 posts
    Member since:
    Dec 2008

    Posted 09 Aug 2013 Link to this post

    Does the DS have any way for me to capture and handle jsonp errors?

    Is there a best practice?

    I've tried this, but nothing happens (no alerts)

    dataSource: new kendo.data.DataSource({
                        serverFiltering: true,
                        transport: {
                            read: {
                                url: function (e) {
                                    var value = $("#activityTypeBox").data("kendoDropDownList").value();
                                    if (value != "") {
                                        return "http://site/api/activities/getByType/id/" + value + "/format/jsonp"
                                dataType: "jsonp",
                                jsonpCallback: 'myCallback'
                            parameterMap: function (data, type) {
                        schema: {
                            errors: "error" // ex: twitter's response is { "error": "Invalid query" }
                        error: function (e) {
                            alert("Problem populating the curriculum db activities based on that type");

  2. Atanas Korchev
    Atanas Korchev avatar
    8462 posts

    Posted 12 Aug 2013 Link to this post

    Hi Steve,

     The error event of the data source relies on the error callback of jQuery.ajax. For some reason that callback is not invoked when using JSONP and the url is wrong. Here is a quick demo showing that: http://jsbin.com/ecofic/1/edit. This seems to be a known limitation.

    Atanas Korchev
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top