Saving data with php backend #1895
Unanswered
Swapnilchavan18
asked this question in
Q&A
Replies: 2 comments
-
@Swapnilchavan18 is it solved? |
Beta Was this translation helpful? Give feedback.
0 replies
-
SendingTo send data to the backend, I base64 encode the json const contentToSend = encode64(JSON.stringify(data)); // data is the editor output At the PHP end, I base 64 decode to get the JSON again, and then save it to the database. $contentForDb = base64_decode($contentSent ?: '');
// save to db RetreivingLater, in PHP, to restore, I get the json from the db, base64 encode it, and send it to the browser. where Javascript base64 decodes it, and then recreates the data object to init the editor const dataForEditor = JSON.parse(decode64(data64)); // data64 came from PHP
Hopefully, that helps a little. I've had quite a bit of trial and error. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I have searched over google, but don't find the correct way to save editorjs output, when we try to save with json there are lot of issues with slashes, JSON decode will not work and will basically remove content with double quotes(after using stripslashes and html_entity_decode) like href, any classes, attributes, etc
What is the best way to save the data that we can also process at PHP backend. Thanks in advance.
Beta Was this translation helpful? Give feedback.
All reactions