Thursday, 15 April 2010

javascript does not pass single quote to php server side correctly -



javascript does not pass single quote to php server side correctly -

i stored in javascript variable

echo '';

as string , http phone call variable transfer php

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

however, result

echo '

and if there

echo ''; echo '';

then result

echo '; echo ';

i wonder how resolve situation kind of javascript build in function can somehow maybe, see ' , create sure none them not disappear.

are there other characters may encounter similar situation?

condition: string stored in js first, can not take string without http call.

i utilize codemirror , angular

i tried tried var myescapedjsonstring = myjsonstring.replace(/'/g, " ' "), happened result becomes"echo "instead....

thanks

javascript php angularjs http codemirror

No comments:

Post a Comment