当前位置:网站首页>The JSON data returned from the control layer to JS has a "\" translator. How to remove it
The JSON data returned from the control layer to JS has a "\" translator. How to remove it
2022-06-30 14:14:00 【Full stack programmer webmaster】
scene : Wrote a ajax, call url after , Returned from the control layer data yes json Format .
ajax The content is , There are notes in it :
$.ajax({
url : '${base}/commonDialog/applyCis5ZZCAntiReport?appNo=${(appNo)!}'+'&loanType='+loanType+
'&loanAmount='+loanAmount+'&loanPurpose='+loanPurpose+'&loanTerm='+loanTerm+
'&custName='+custName+'&mobile='+mobile+'&idNo='+idNo,
type : "post",
success:function(res){<#--url After call , The data returned is in res in -->
$("#result").empty();<#--result It's a div Of id. No need to consider -->
var json="";
json=JSON.stringify(res,null, 4);<#-- I don't know what it means , Should be json turn var Format Bar !-->
$("#result").append(json);<#-- Append the returned result to div in , At this time, the additional content is the full screen translation symbol "\">
}
})
});Baidu has many ways , None of them solved , The most important thing is to use replacet Replace , The closest thing to the expected result is the success In the method , add :
var json=res.replace("\\","");
$("#result").append(json);This method is really to remove many translation characters ”\”. But in the case of complex levels json character string , It's hard to avoid getting caught , Because, after all, it is not solved from the root cause of this situation .
js It's supporting json Format , From the background to the front end, if no data format is specified , It should default to a string , hold json Format data /toString() Printing to the console is with ”\” Of . So as long as ajax Specify the format of the returned data in ! add “dataType:json” that will do .
type:"post"
dataType:"json",Publisher : Full stack programmer stack length , Reprint please indicate the source :https://javaforall.cn/106262.html Link to the original text :https://javaforall.cn
边栏推荐
- 想請教一下,我在佛山,到哪裏開戶比較好?手機開戶是安全麼?
- Simple understanding of the difference between get request and post submission
- (8) JMeter component detailed once only controller
- Optimization of unit test efficiency: why test programs? What are the benefits of testing?
- [the path of system analyst] Chapter 5 Software Engineering (Agile Development)
- 可觀測,才可靠:雲上自動化運維CloudOps系列沙龍 第一彈
- Impersonate server and client using message queuing
- Apache Doris comparison optimization Encyclopedia
- Chapter 13 signal (III) - example demonstration
- 从控制层返回到js的json数据带“\”转译符,怎么去掉
猜你喜欢
![[scientific research data processing] [basic] category variable frequency analysis chart, numerical variable distribution chart and normality test (including lognormal)](/img/70/8bf226964118efb324ca4d339df654.png)
[scientific research data processing] [basic] category variable frequency analysis chart, numerical variable distribution chart and normality test (including lognormal)

Google Earth Engine(GEE)——GHSL:全球人类住区层,建成网格 1975-1990-2000-2015 (P2016) 数据集

Apache Doris comparison optimization Encyclopedia

Jetpack compose for perfect screen fit

Wuenda 2022 machine learning special course evaluation is coming!

go time. after

【观察】智能产业加速,为何AI算力要先行?

Tencent two sides: @bean and @component are used on the same class. What happens?

About the problems encountered when using the timer class to stop with a button (why does the QPushButton (for the first time) need to be clicked twice to respond?)

【刷题篇】避免洪水泛滥
随机推荐
Dart 扩展特性
ot initialized – call ‘refresh’ before invoking lifecycle methods via the context: Root WebApplicati
Yousi College: Six Sigma is not just statistics!
【科研数据处理】[基础]类别变量频数分析图表、数值变量分布图表与正态性检验(包含对数正态)
想请教一下,我在佛山,到哪里开户比较好?手机开户是安全么?
"As a service", the inevitable choice of enterprise digital transformation
数据恢复软件EasyRecovery15下载
Deep understanding Net (2) kernel mode 4 Summary of kernel pattern constructs
科普达人丨漫画图解什么是eRDMA?
幸运哈希竞猜系统开发(源码部署)趣投哈希游戏玩法开发(案例需求)
Laravel RBAC laravel permission use
【科研数据处理】[实践]类别变量频数分析图表、数值变量分布图表与正态性检验(包含对数正态)
JMeter transaction controller
Fastcgi CGI shallow understanding
PHP excel export function encapsulation (based on phpexcel class)
从控制层返回到js的json数据带“\”转译符,怎么去掉
Detailed explanation of the first three passes of upload Labs
Go common lock mutex and rwmutex
Step by step | help you easily submit Google play data security form
I'd like to ask you, where can I open an account in Foshan? Is it safe to open a mobile account?