javascript - Object doesn't support property or method 'values' -
this question has answer here:
i trying write codes json file , read. codes works in chrome, doesn't works in ie11 , need use ie, real solution solve problem actually. changed value names same problem still seems.
<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>
instead of line,
myobjects = object.values(deneme); write,
myobjects = object.keys(deneme).map(itm => deneme[itm]); because, object.values experimental feature , not being supported in ie.
if browser doesn't supports arrow functions write,
myobjects = object.keys(deneme).map(function(itm) { return deneme[itm]; });
Comments
Post a Comment