In my program there is a variable name ‘quotes’ which takes an input string from an API call.
Program doesn’t work when the string has a single quote in it.
<script>
var quotes = "Empty"
if(user.quotes)
quotes = user.quotes; // get the string to 'quotes' variable
</script>
can any one please tell me how to fix this problem?
Replace single quote (escape it like PHP):
Then wherever You use Your quotes, replace the “\'” back to “‘”.