Answer the question
In order to leave comments, you need to log in
Why is the data not being sent in json format?
Good afternoon. Unfortunately, I don’t fully understand the php + js bundle, and, accordingly, it’s hard to navigate with ajax. When I pass data from the form and process
it, the data is transferred well, but if I send data using
then I get an error
if(!empty($_POST)){ }
if(isset($_POST['name'])){ }
SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
Answer the question
In order to leave comments, you need to log in
In Google Chrome Ctrl+Shift+I Network tab - here you will see what data the php script sends
I had the same problem the other day.
And I'm willing to bet it's the quotation marks.
This build helped me.addslashes(json_encode($video,JSON_HEX_QUOT));
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question