Fix support issue 354, Web Remote causes a stacktrace when sending an Alert message.

bzr-revno: 1855
This commit is contained in:
Mattias Põldaru 2011-12-23 16:35:51 +00:00 committed by Jonathan Corwin
commit e59d5b014b

View File

@ -208,7 +208,9 @@ window.OpenLP = {
},
showAlert: function (event) {
event.preventDefault();
var text = "{\"request\": {\"text\": " + $("#alert-text").val() + "}}";
var text = "{\"request\": {\"text\": \"" +
$("#alert-text").val().replace(/\\/g, "\\\\").replace(/"/g, "\\\"") +
"\"}}";
$.getJSON(
"/api/alert",
{"data": text},
@ -219,7 +221,9 @@ window.OpenLP = {
},
search: function (event) {
event.preventDefault();
var text = "{\"request\": {\"text\": \"" + $("#search-text").val() + "\"}}";
var text = "{\"request\": {\"text\": \"" +
$("#search-text").val().replace(/\\/g, "\\\\").replace(/"/g, "\\\"") +
"\"}}";
$.getJSON(
"/api/" + $("#search-plugin").val() + "/search",
{"data": text},