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?
phpcn_u15822017-06-26 10:53:34
You can get the object content through console.dir(a);, so you can see that there is a data attribute, and you can get the string by getting the .data attribute.
typecho2017-06-26 10:53:34
JSON.stringify() Try if it works
stringify() is used to parse a string from an object, such as
var
a = {a:1,b:2}
Result:
JSON.stringify(a)
"{"a":1,"b":2}"
阿神2017-06-26 10:53:34
Try .data
or .wholeText
alert(a.data);
Result of The result of
Result of