Thursday, 15 January 2015

php - How to escape single quote,double quotes and backlash in javascript? -



php - How to escape single quote,double quotes and backlash in javascript? -

i create query , have query result. set query result in javascript function there error because single quote,double quotes, slashes , + , etc.. include in there result. how solve this?

function add(1,'10 units (manastone: crit strike +19 / attack +2)',3);

above function use. "10 units (manastone: crit strike +19 / attack +2)" create code stop.

to phone call javascript function , must :

add(1,'10 units (manastone: crit strike +19 / attack +2)',3);

instead of

function add(1,'10 units (manastone: crit strike +19 / attack +2)',3);

your error simple. you're mix function declaration

function mafunc( param1, ... ) {}

and function calling :

mafunc( "myparamvalue1", ... ) {}

javascript php html ajax

No comments:

Post a Comment