Strip out slash-escaped JSON sequence received in client.
The server will slash-escape some JSON related characters before sending. Need to strip them out before using, on the client side.
This commit is contained in:
parent
5d28ef9fbe
commit
6a5ca43e7e
@ -151,14 +151,23 @@ define(['jquery',
|
||||
return false;
|
||||
},
|
||||
|
||||
removeSlashesFromJSON: function(str) {
|
||||
// slashes are leftover escapes from JSON serialization by server
|
||||
// for every two char sequence starting with backslash,
|
||||
// replace them in the text with second char only
|
||||
return str.replace(/\\(.)/g, "$1");
|
||||
},
|
||||
|
||||
renderFeedback: function(feedback) {
|
||||
this.$curFeedback.html(polyglot.t(feedback) || "");
|
||||
var s = this.removeSlashesFromJSON(feedback);
|
||||
this.$curFeedback.html(polyglot.t(s) || "");
|
||||
this.$curFeedback.show(400)
|
||||
|
||||
},
|
||||
|
||||
renderOutput: function(output) {
|
||||
this.$curOutput.html(polyglot.t(output) || "");
|
||||
var s = this.removeSlashesFromJSON(output);
|
||||
this.$curOutput.html(polyglot.t(s) || "");
|
||||
this.$curOutput.show(400)
|
||||
},
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user