2
I am maintaining an application where there is now the need to load an HTML from the database into a div. Regarding the return of this database HTML, it’s cool, I already receive the values in a JSON and could (eventually) load it in the view, but simply does not load.
I’ll show you the code:
$.ajax({
url: '<minha url>',
dataType: 'html',
type: 'post',
data: {<meus parametros>},
success: function(data){
$('#load-html-template').html(data[0].TemplateText);
}
As to the dataType
, have already sent as HTML (returns nothing), JSON (returns HTML as a string), XML (loads nothing), etc...
Solved one part of the problem - entering another
Thanks for your help so far, but now I have direct access to the database and realized that, the HTML code is in special characters format, this way:
<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’ve done it, but still the problem follows...
mystring.replace(/&/g, "&").replace(/>/g, ">").replace(/</g, "<").replace(/"/g, """);
Could give me a strength!!! Thanks in advance!!!
You can put here what appears with
console.log(data);
?– Sergio