0

I have this problem when data has a quotation, ('), it's ruiningg the JSdata which now I cannot fetch. is there any way to prevent this?

enter image description here

the ' in Haven't ruined the data.

5
  • 4
    try to use single quotes? data-payload='<json>' Commented Jun 4, 2021 at 9:56
  • i'm using json_encode to turn it into json Commented Jun 4, 2021 at 9:58
  • and also, im using single quotes for data-payload Commented Jun 4, 2021 at 9:58
  • 1
    Hard to tell what your setup is, but this would work: data-test="<?= htmlentities(json_encode($test)); ?>" - that will escape double quotes. Commented Jun 4, 2021 at 10:07
  • 2
    Please also read Why not upload images of code/errors when asking a question? Commented Jun 4, 2021 at 10:21

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.