I'm maintaining an application where there is now a need to load an HTML from the database into a div. As for the return of this HTML from the database, it's cool, I already get the values in a JSON and could (possibly) load it into the view, but it just does not load.
I'll show the code:
$.ajax({
url: '<minha url>',
dataType: 'html',
type: 'post',
data: {<meus parametros>},
success: function(data){
$('#load-html-template').html(data[0].TemplateText);
}
As for dataType
, I already sent as HTML (does not return anything), JSON (returns the HTML as a string), XML (does not load anything), etc ...
Solved one part of the problem - entering another
Thanks for the help guys so far, but now I have direct access to the database and I noticed that the HTML code is in special character format, like this:
<html>
<head>
</head>
<body>
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>
<td width="2%">&#160;</td>
<td width="920px">
<div style="line-height:120%;font-family:Arial;font-size:15pt;background-color:#e8eae8;"><form action=""><table border="0" cellspacing="1" cellpadding="0" width="99%">
......
Well, how to convert these tags to the HTML tags in question? I already did this, but still the problem goes ...
mystring.replace(/&/g, "&").replace(/>/g, ">").replace(/</g, "<").replace(/"/g, """);
Could you give me strength !!! Thanks in advance!