I have an Ajax form that I want to allow the users to include apostrophes.
function print_and_update(id,type)
{
$.ajax(
{
url: "index.php",
cache: false,
type : "GET",
data:
{
"q1" : $('#q1').val(),
"q2" : $('#q2').val(),
"q3" : $('#q3').val(),
......
"q10" : $('#q10').val(),
},
success: ....
So I can replace the apostrophe for each individually. But is the best way? Should I be able to replace it for all the input text data?
"q1" : $('#q1').val().replace(/'/g, "'"),
I tried editing the PHP by adding htmlspecialchars and stripslashes with no success. How can I allow apostrophes for all text inputs?