I've a problem with TinyMCE. When I load the TinyMCE textarea content (with jQuery) into my database, and then I see the result on a php page, I see html tag...in the picture you can find an example.
HTML
<div class="container pt">
<!-- +++++ Posts Lists +++++ -->
<div class="row mt">
<div class="col-lg-6 col-lg-offset-3 centered">
<h3>MY BLOG</h3>
<hr>
</div>
</div>
<div id="white">
<div class="container">
<div class="row">
<div class="col-lg-8 col-lg-offset-2" id="menublog">
</div>
</div><!-- /row -->
</div> <!-- /container -->
</div><!-- /white -->
</div>
JQuery
$(document).ready(function() {
$("#Insert").click(function(){
event.preventDefault();
var user = "2", titolo = $('#titolo').val(), articolo = tinyMCE.activeEditor.getContent({format : 'raw'});
var id_immagine = $('#menuimmagini').val();
alert(id_immagine);
object = JSON.stringify({r: 'InsertPost', u: user, t: titolo, a: articolo, i:id_immagine});
$.post("server.php", { js_object: object },
function(msg){
console.log(msg);
if(msg)
{
alert("Post inserito con successo!");
location.reload();
}
});
});
});
OUTPUT JQUERY
$(document).ready(function() {
event.preventDefault();
object = JSON.stringify({r: 'InitializeBlog'});
$.post("servo.php", { js_object: object },
function(response)
{
var obj = jQuery.parseJSON(response);
$.each( obj, function( index ) {
$('#menublog').append("<p><img class=\"img-circle\" src=\"assets/img/user.png\" width=\"50px\" height=\"50px\"> <ba>Salvo Bertoncini</ba></p> <p><bd>Posted on "+obj[index].date+"</bd></p> <h4>"+obj[index].title+"</h4> <p><img class=\"img-responsive\" src=\"show.php?id="+obj[index].idimmagine+"\"></p> "+obj[index].articles+" <p><a href=\"article.php?id="+obj[index].id+"\">Continue Reading...</a></p><hr>");
});
}
);
});
All editor WYSWYG convert the content to html entities. you should use this library for example:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.