简体   繁体   English

从 Javascript 字符串中删除文本

[英]Remove text from Javascript string

given below is the picture of the response I get on submitting a form with wrong email.下面给出的是我在提交带有错误 email 的表单时得到的响应图片。 我的回复图片

I want to remove the word message: & curly brackets around the string from this response.我想从此响应中删除字符串周围的单词message: & 大括号。 I am trying the following:我正在尝试以下操作:

$('#registerStatus').text(response.replace('message:', ''))

But it doesnt work.但它不起作用。 Can you please help?你能帮忙吗?

The response is a JSON Object, so you can write:响应是 JSON Object,所以你可以写:

$('#registerStatus').text(response.message)

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

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