javascript - How to convert the text in Object Text into a string? Waiting online, urgent!
为情所困
为情所困 2017-06-26 10:51:34
0
4
933

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?

为情所困
为情所困

reply all (4)
phpcn_u1582

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.

    typecho

    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}"

      阿神

      Try.dataor.wholeText

      alert(a.data);
      Result of

      alert(a):

      The result of

      alert(a.data):

      Result of

      alert(a.wholeText):

        女神的闺蜜爱上我

        How is the data? Post a picture. I don’t know what’s going on!

          Latest Downloads
          More>
          Web Effects
          Website Source Code
          Website Materials
          Front End Template
          About us Disclaimer Sitemap
          php.cn:Public welfare online PHP training,Help PHP learners grow quickly!