我在视图中将以下字符串作为变量输出到textarea中。这是一个AJAX调用,我可以通过响应看到空间正在通过。但是,我的textarea中忽略了所有空格。我该如何防止这种情况?
"status": "success",
"matches": "1",
"results":
{
"id": "56342",
"call_date": "2011-08-24 00:00:00",
"tracking_number": "12223334444",
"ringto_number": "12223334444",
"direction": "inbound",
"duration": "127",
"file_url": "http://www.logmycalls.com/recordings/somesound.mp3",
"reviewer": "admin@myaccount.com",
"scorer": "user@myaccount.com",
"score_grade": "87",
"score_outcome": "pass",
"status": "active"
}
]
这就是textarea中的样子:
[
"status": "success",
"matches": "1",
"results":
{
"id": "56342",
"call_date": "2011-08-24 00:00:00",
"tracking_number": "12223334444",
"ringto_number": "12223334444",
"direction": "inbound",
"duration": "127",
"file_url": "http://www.logmycalls.com/recordings/somesound.mp3",
"reviewer": "admin@myaccount.com",
"scorer": "user@myaccount.com",
"score_grade": "87",
"score_outcome": "pass",
"status": "active"
}
]
答案 0 :(得分:2)
Css属性:
white-space: pre;