So I'm uses this setup to send a JSON object through PostMessage plugin and on the receiving end I'm using $.parseJSON(result);
The problem is stringify is adding a bunch of + symbols to the object where there are white space.
So here is what I'm sending through postMessage before it is stringifyed.
{type="page", pageName="bla > bla bla > / whatever"}
Then on the receiving end after I run $.parseJSON(result); I'm getting.
{"type":"page","pageName":"bla+>+bla+bla+>+/+whatever"}
How do I escape or not have all the + symbols. If PostMessage is turning it into query string encoding, then can I remove the + symbols from the string before I $.parseJSON().
PostMassage receive method
$.receiveMessage(function(e){
var params = e.data.split("&");
var result = {};
for (var i = 0; i < params.length; i++){
var tmp = params[i].split("=");
result[tmp[0]] = unescape(tmp[1]);
}
var msg = result['message'];
}
So msg is a string before I parseJSON
$.parseJSON(result['message']);
I tried to use .replace on the message but that didn't work. example of what message string is:
msg = '{"type":"page","pageName":"bla+>+bla+bla+>+/+whatever"}'
var msg = result['message']replace("+", " ");
Thanks