When writing a javascirpt program, use the $.post method to send data. If the characters in the data contain '<', $.post will not be executed successfully.
var jsonstr='{"value":"abcd< efg"}';
$.post(
url,
{ "jsonstr": jsonstr },
function (data, status) {
});
It needs to be escaped before use. After escaping using the transferredChars function below, pass the data $.post to execute.
This function replaces '<' and '>' with '<' and '>' respectively.
transferredChars=function (htmlChars) {
var tcs = htmlChars.replace(/tcs = tcs.replace(/>/g, ">");
return tcs;
}
var jsonstr='{"value" :"abcdjsonstr=transferredChars(jsonstr);
$.post(
url,
{ "jsonstr": jsonstr },
function (data, status ) {
});
The jquery version used is 1.7.1.min