DataSource Error (only in IE )

5 posts, 0 answers
  1. Dr.YSG
    Dr.YSG avatar
    210 posts
    Member since:
    Dec 2009

    Posted 18 Jun 2012 Link to this post

    I am not getting this error from the datasource ("No Transport") for the URL: http:/localhost:4326/mTypes (a local WCF service) on the same machine as the browser.

    The data is in JSON format.

    Chrome 19, FireFox 13 Do not throw this error.

    IE is NOT in compatibility mode.
    It is a 64 bit browser.

    The e.ErrorThrown  is "No transport"

    SearchData.dataSourceTemplate = {
        type:"json",
        transport:{
            read:{
                url:"http://localhost:4326/mTypes",
                dataType:"json"
            }
        },
        schema:{
            data:"results",
            total:"count"
        },
        error:function (e) {
            alert("Search.js datasource error: " +
                "\nthrew: " + e.errorThrown +
                "\nstatus: " + e.status +
                "\nurl: " + e.sender.transport.options.read.url);
        }
    };



  2. Rosen
    Admin
    Rosen avatar
    3237 posts

    Posted 19 Jun 2012 Link to this post

    Hi,

    The error in question is a jQuery ajax error. I suspect that in your case it is caused by the cross-domain request. As you may know IE does not support CORS, which I suspect is used in your implementation. More information about CORS and a possible fix for the IE/jQuery ajax behavior can be found in this blog post.

    Regards,
    Rosen
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Kendo UI is VS 2017 Ready
  4. Dr.YSG
    Dr.YSG avatar
    210 posts
    Member since:
    Dec 2009

    Posted 19 Jun 2012 Link to this post

    Cross Domain is certainly occurring, but I don't know if that is the issue here. (I did read carefully the blog post).
    With FireFox and Chrome, I can watch with fiddler, and I see that I am returning Access-Control-Allow-Origin from my WCF Data service:

    HTTP/1.1 200 OK
    Content-Length: 288
    Content-Type: application/json; charset=utf-8
    Server: Microsoft-HTTPAPI/2.0
    Access-Control-Allow-Origin: *
    Date: Tue, 19 Jun 2012 13:55:19 GMT
     
    {"count":11,"results":[{"id":1," ...


    However, with IE, I get an immediate array from AJAX of e.ErrorThrown  is "No transport", and Fiddler is not showing even the HTTP GET request appearing on the wire. So, even though your blog posts a lot of tricks to do on the server side, if I never see the request, then how am I going to convince the IE XDomainRequest object (if it is true that JQUERY is not using XMLHttpRequest ) that this request is ok.
    It seems that the hack has to done somewhere inside of either Kendo's DataSource, or how JQuery is using the XDomainRquest object.

    Or maybe the answer is simpler and this is just some sort of security setting in IE that is rejecting cross domain calls and not firing the GET?

    Anyway I also have a Google Map in the Kendo application, so that is showing up in fiddler as CORS calls (maps.googleapis.com)

  5. Rosen
    Admin
    Rosen avatar
    3237 posts

    Posted 20 Jun 2012 Link to this post

    Hi,

    There is no request made, as jQuery cannot find a transport in order to do so, thus the error is thrown. Did you try the approach described under Fixing IE with jQuery $.ajax transports section of the blog post I have linked to in my previous message.

    Regards,
    Rosen
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  6. Dr.YSG
    Dr.YSG avatar
    210 posts
    Member since:
    Dec 2009

    Posted 20 Jun 2012 Link to this post

    As I said, I did read line by line the entire blog post. Most of it deals with Server side actions (such as: Access-Control-Allow-Origin: *) which I am already doing. But the error is not on the server, since I don't get there. The Jquery AJAX was not even doing a GET request.

    I did not try the <script src="scripts/jquery.iecors.js"></script> script from Derek Kastner, https://github.com/dkastner/jquery.iecors (so I don't know if it works)

    Because I found a much simpler trick that you might want to add to your blog:

    The following line to the first thing you do in javascript when the page is loaded:

    jQuery.support.cors = true;

    It does not hurt IE or Chrome users, and will make IE behave much better!

    It might be wise to add this to your next release for any browser that has some level of CORS support (i.e. does not need some messy polyfill) [XHR2/CORS or XDR are available - then set CORS support to true]. Actually the jQuery folks should probably be doing this.


Back to Top
Kendo UI is VS 2017 Ready