I’m making a wordpress plugin which permit person to pick totally different emojis with textual content. I’m then making a fetch request to again finish to replace with chosen emoji. Proper now I’m simply rendering an image. and it saved as a tough coded emoji in
.php file. Nonetheless I may very well be including extra emoji’s later.
My query is
- How can I confirm textual content posted / rendered is definitely an emoji (ie.
- How I can guarantee emoji is secure to render on FE after which
fetch/ajaxsubmit request to backend and have the emoji
secured with encoding/decoding?
// Render from Backend to frontend JS fixed const moodList = <?php echo json_encode( ['😀 - smile', '😁 - grin', '😂 - tears of joy', '🤣 - rofl', '😅 - smiling cold sweat'] ); ?>
// Replace my HTML const moodlist = ['😀 - smile', '😁 - grin', '😂 - tears of joy', '🤣 - rofl', '😅 - smiling cold sweat'] doc.querySelector('.moods').innerHTML = moodlist.be a part of(' ');
Thanks a bunch prematurely.