AJAX 手动和自动将请求的JSON数据进行字符串转换
距离上次更新已经过了 1772 文中部分内容可能已经过时,如有疑问,请在下方留言。
我们请求后端的时候一般返回的是字符串,而我们需要的数据,因此我们在请求到JSON数据的时候需要对他们进行转换。
手动转换
借助JSON的parse方法。
javascript
1 | //发送请求 |
自动转换
借助xhr对象上的一个属性来进行设置。
javascript
1 | //发送请求 |

Invitation
aqing
962555446
created:15/04/2021
Welcome to Candyhome
Use this card to join the candyhome and participate in a pleasant discussion together .
Welcome to aqing's candyhome,wish you a nice day .
评论