I am trying to write some codes to get json file and read. But this codes works in chrome, doesn't works in IE11 and I need to use IE, What is the real solution for solve this problem actually. I changed some value names but same problem still seems.
Error Message
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
</head>
<body>
<table id="userdata" border="0.02">
<th>Revision Date</th>
<th>Document Name</th>
<th>Department </th>
<th>Description</th>
<th>Link</th>
</table>
<script>
myObjects = [];
$.getJSON('https://api.myjson.com/bins/1djve3', function(deneme) {
myObjects = Object.values(deneme);
console.log("Objects in array " + myObjects.length);
$.each(myObjects, function(i, person) {
$('#userdata th:nth-child(2)').html(person.revisiondate)
console.log("Person-" + person.revisiondate);
console.log("Person-" + person.documentname);
console.log("Person-" + person.department);
console.log("Person-" + person.description);
console.log("Person-" + person.link.split('href=')[1]+"' "+person.link.split('href=')[1]);
var $row =
"<tr><td>" + person.revisiondate +
"</td><td>" + person.documentname +
"</td><td>" + person.department +
"</td><td>" + person.description +
"</td><td><a target='_blank' href='"+ person.link.split('href=')[1]+"' >"+person.link.split('href=')[1]+"</a></td></tr>"
$('table> tbody:last').append($row);
});
});
</script>
</body>
</html>
The Object.assign() method copies all enumerable own properties from one or more source objects to a target object. It returns the modified target object.
Object. assign() returns a target object. In case of a name collision between a source and target property, Object. assign() will overwrite the local property of the target object.
var clone = Object. assign({}, obj); The Object. assign() method is used to copy the values of all enumerable own properties from one or more source objects to a target object.
Instead of this line,
myObjects = Object.values(deneme);
write,
myObjects = Object.keys(deneme).map(itm => deneme[itm]);
Because, Object.values is an experimental feature and it is not being supported in IE.
If your browser doesn't supports arrow functions too then write,
myObjects = Object.keys(deneme).map(function(itm) { return deneme[itm]; });
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With