Javascript toSource() method not working

前端 未结 5 1776
臣服心动
臣服心动 2020-12-05 18:58

I\'m getting a \"Object doesn\'t support this property or method error\", does anyone know why?

I do have values plugged into userId, fname, lname, oname, sam, hasAc

5条回答
  •  难免孤独
    2020-12-05 19:18

    You can either call toString instead, or put in a condition like this...

    var jsonstuff = (emp.toSource) ? emp.toSource() : emp.toString();
    

    EDIT:

    Since this is not working for you, you might want to use JSON.stringify()

提交回复
热议问题