0

I stored in javascript variable that

echo '';

as a string and http call the variable to transfer it into php with

$data = file_get_contents("php://input");
$objData = json_decode($data);

However, the result will be always as

echo '

and if there is

echo '';
echo '';

then result will be

 echo '; 
 echo ';

I wonder how to resolve this situation with some kind of javascript build in function that can somehow maybe, see all the ' and make sure none them will not disappear.

Are there other characters that may encounter similar situation?

CONDITION: the string is stored in js first, I can not take the string without an http call.

I use CodeMirror and Angular

I tried I tried var myEscapedJSONString = myJSONString.replace(/'/g, " ' "), but its just happened that result becomes"echo "instead....

Thanks

ey dee ey em
  • 7,991
  • 14
  • 65
  • 121

0 Answers0