0

I just wrote some JQuery script to practice accessing JSON data and it ran perfectly on Firefox, Chrome and IE 11. However, it failed running on IE 8 with following error message:

Message: Object doesn't support this property or method
Line: 2
Char: 29489
Code: 0
URI: http://code.jquery.com/jquery-2.1.0.min.js


Message: '$' is undefined
Line: 12
Char: 4
Code: 0

Is it because JQuery 2.x stops supporting IE 8? According to http://jquery.com/browser-support/, or other causes? I cannot figure it out.

Anyone got any hints? Thanks in advance.

The code is below:

    <!DOCTYPE html>
<html>
  <head>
  <title>test</title>
  <script type="text/javascript" src="http://code.jquery.com/jquery-2.1.0.min.js"></script>
  </head>
  <body>
    <div id="div1">dv1</div>

    <script type="text/javascript">
    function getData(){
        $.ajax({
            type:"GET",
            url:"j.json",
            dataType:"json",
            success: function(jsondata){
                output(jsondata);               
            }
        });
    }

    function output(json){

        //var Data = eval('(' + json + ')');
        var html = '';
        //alert(Data.length);
        for(var i=0;i<json.length;i++){
            html += ' name:' + json[i].name + ' age:' + json[i].age;
        }

        document.getElementById('div1').innerHTML = html;

    }

    setInterval(getData, 3000);

    </script>             
  </body>
 </html>

1 Answer 1

3

jQuery 2.0 does not support IE8 or earlier. You must use some 1.x version of jQuery.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.