简体   繁体   English

如何将文本/纯文本转换为字符串?

[英]How to convert text/plain to string?

I am calling an API in a function that sends back a single line in text/plain format, I was wondering how I can receive this information and put it into a string variable aString .我在 function 中调用 API 以text/plain格式发回单行,我想知道如何接收此信息并将其放入字符串变量aString

When I use the API url in my chrome browser, I see the information that I need " MyInfo ".当我在 Chrome 浏览器中使用 API url 时,我看到了我需要“ MyInfo ”的信息。

Thanks,谢谢,

turns out all I needed to do was append ***.text() to the end of the response body.原来我需要做的只是 append ***.text()到响应正文的末尾。

If you are using jquery then you can use jquery promises to handle this scenario.如果您使用的是 jquery 那么您可以使用 jquery 承诺来处理这种情况。 A little more information from your end will help us to provide a better solution.您提供的更多信息将帮助我们提供更好的解决方案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM