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>