I got an Object Text from the background here, and now I need to convert it to String for output. Could you please tell me how I can convert it? I tried many methods on the Internet but it didn't work. . .
It looks like this when the content alert pops up
Let it output on the console like this
I want to turn it into a string because there are subsequent operations. Is there any way?
通过console.dir(a);可以获得对象内容,,这样可以看到有一个data属性,,获取.data属性就可以获得字符串了。
JSON.stringify()试试是否可以
stringify()用于从一个对象解析出字符串,如
var
a = {a:1,b:2}
结果:
JSON.stringify(a)
"{"a":1,"b":2}"
试一下
.data
或者.wholeText
alert(a)的结果:
alert(a.data)的结果:
alert(a.wholeText)的结果:
数据怎么样的,你贴个图吧,我看着不知道怎么回事!