How will i find an aprostophe (single quote ) in jquery if user has in it's message . If it is there the replace or escape because sql server doesnot accept single quotes.
If message does not contain single quote the i want to send message as message because message may have image files , tables or videos .
i am trying this
var message = contents.replace(/[!'()*&"<>]/g, escape);
but it is saving like below in db & giving user
%3Cp%3Ethis isn%27t good it%27s not saving%26nbsp;%3C/p%3E
Also if i will not put a check then it saves the video's the same way
Please help
Kirtesh ShahPosted Jun 18, 2021, 4:05 PM
Sachin SinghPosted Jun 18, 2021, 3:08 PM
r kPosted Jun 18, 2021, 3:04 PM
Sachin SinghPosted Jun 18, 2021, 2:41 PM
at first SQL Server does understand the single quote, you just need to replace the single quote to a double quote in order to consider it as a single quote by SQL server.
var message = contents.Replace("'","\"");