0

in my application, i do an ajax call to a php method, like this:

$.ajax({
        type:'POST',
        url:'/myPhpMethod',
        data:data,
        success:function(data){
            alert(data);
        },error(msg, e){}
    });

the php method returns a string in html format retrieved from the database like this

<div>Hello World</div><br><div>My name is John</div>

At this point, javascript modifies the string in the following format:

&#38;lt;div&#38;gt;Hello World&#38;lt;/div&#38;gt;&#38;lt;br&#38;gt;&#38;lt;div&#38;gt;My name is John&#38;lt;/div&#38;gt;

I need to put the HTML string in a WYSIWYG HTML Editor, but it is not possible in that encoded string.

Thanks in advance for help

pasluc74669
  • 1,680
  • 2
  • 25
  • 53
  • Are you sure it's like that in the database, and that the PHP code is not passing it through htmlentities? – aynber Sep 15 '20 at 17:52
  • see https://stackoverflow.com/questions/1912501/unescape-html-entities-in-javascript – Oleg Sep 15 '20 at 17:55
  • Yes, I'm sure, because when I do a dd(mystring) in the php code, it returns the right html string. – pasluc74669 Sep 15 '20 at 18:09

0 Answers0