Load ajax data failes with IE 11and jquery 2.1.4 but works on firefox or with jquery 1.11.3

Load ajax data failes with IE 11and jquery 2.1.4 but works on firefox or with jquery 1.11.3

alierkolalierkol Posts: 4Questions: 1Answers: 0

Hi,

I have a question regarding the loading of data via Ajax data source. I think the Ajax source that I use and the DataTable() call is ok, because I receive the ajax data on Firefox using jquery 2.1.4 or 1.11.3, but with IE 11 it works only with jquery 1.11.3, not with 2.1.4. I also see no error message in the log console or as a popup.
Does anyone have an idea or a hint what to do?

Thanks in advance
Ali

Answers

  • allanallan Posts: 61,446Questions: 1Answers: 10,055 Site admin

    Can you link to a test case showing the issue, per the forum rules, please.

    Allan

  • alierkolalierkol Posts: 4Questions: 1Answers: 0

    Hi Allan,

    below is just a simple example, taken from the datatables-help sites. This works not for ie11 but for e.g. Firefox. If you change

    <

    script type="text/javascript" language="javascript"
    src="http://code.jquery.com/jquery-2.1.4.min.js">

    to

    <

    script type="text/javascript" language="javascript" src="http://code.jquery.com/jquery-1.11.3.min.js">

    it works for also for ie.

    Any ideas?

    Thanks for your time!


    arrays.txt:


    {
    "data": [
    [
    "Tiger Nixon",
    "System Architect",
    "Edinburgh",
    "5421",
    "2011\/04\/25",
    "$320,800"
    ],
    [
    "Garrett Winters",
    "Accountant",
    "Tokyo",
    "8422",
    "2011\/07\/25",
    "$170,750"
    ]
    ]
    }


    html code:


    <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.10/css/jquery.dataTables.min.css">
    <style type="text/css" class="init">
    </style>
    <script type="text/javascript" language="javascript" src="http://code.jquery.com/jquery-2.1.4.min.js">
    </script>
    <script type="text/javascript" language="javascript" src="https://cdn.datatables.net/1.10.10/js/jquery.dataTables.min.js">
    </script>
    
    $(document).ready(function() { $('#example').DataTable( { "ajax": "data/arrays.txt" } ); } );
    Name Position Office Extn. Start date Salary
  • allanallan Posts: 61,446Questions: 1Answers: 10,055 Site admin

    Can you use JFiddle or http://live.datatables.net (or similar) to post a test case please. See also how to ask for help.

    Thanks,
    Allan

  • alierkolalierkol Posts: 4Questions: 1Answers: 0

    I have posted a test case to http://jsfiddle.net/m4xs10kz/ but the problem does not occur here for jquery-2.1.4.
    Could it be the case that there has been added a restriction in the 2.1.4 for loading a json file in the local machine?

  • allanallan Posts: 61,446Questions: 1Answers: 10,055 Site admin

    I guess its possible, but I'd be really surprised if it is. You'd need to ask the jQuery folks, but likely they will need a test case showing the issue as well.

    Allan

  • MikeSMikeS Posts: 113Questions: 1Answers: 0

    @alierkol, are you trying to load a json file that resides on your local pc's hard drive? i.e., using URL with FILE:// that points to a json file from say, c:/mydata/jsondata.txt?

    If so, then yes. The Jquery team made core changes on the 2.0 branch that killed that ability in IE. Because of this, I am stuck with the jquery 1.x branch. Follow this to see the jquery bug report...http://forum.jquery.com/topic/jquery-2-0-3-and-ajax-local-files

  • alierkolalierkol Posts: 4Questions: 1Answers: 0

    Hi Mike,
    that's exactly the case with the local ajax file with my test. I have the problem also only on jquery version 2.x but not on 1.x as in the jquery Forum report described.
    So thank you very much for your posting.
    Ali

  • allanallan Posts: 61,446Questions: 1Answers: 10,055 Site admin

    Very interesting - thanks for posting this @MikeS! Will store that one away in my own personal hard drive (brain)!

    Allan

  • MikeSMikeS Posts: 113Questions: 1Answers: 0

    No problem guys. In case you didn't figure it out, that was my jquery bug report :)

    Sadly, we're stuck on the 1.x branch. I really wish there was a way to get it to work in jquery 2.x.

  • allanallan Posts: 61,446Questions: 1Answers: 10,055 Site admin

    To be honest I'm somewhat surprised that any browser will allow an Ajax request to get a local file - that sounds really scary! "Ajax: /etc/passwd" for example!

    Having said that, if IE has some kind of limited allowance to get some of the user's files perhaps you could just create an XMLHttpRequest the old fashioned way rather than using jQuery's $.ajax?

    Allan

This discussion has been closed.