I have JSON text that has a body tag with text like:
[
{
"body":<ul>\n<li>Place item in the&nbsp;<strong>box.<\/strong,
"category":"A",
"title":"A box",
"keywords":"bread bag tag, milk bag tag, elastic band, rubber band, twist tie, rope, twine, string, hemp, ribbon, bow, burlap, staple";
}
]
(The original JSON file is in correct syntax) The JSON file has many tags like that with title, body, and keywords. I am supposed to search with keywords (from input box in html), match and then display title and body. I can display the title with no problem. I can display body like:
<ul><li>Place item in the <strong>box</strong></li>
I have tried using .html(), .text(), $.parseHTML in all combinations. Here's the code snippet:
$.getJSON(url, function(response)
{
if(response.length)
{
$('#table_item').empty();
var content = '';
for(var i = 0; i < response.length; i++)
{
if((response[i].keywords).indexOf(key) != -1)
{
content += '<div class="row"><div class="column"><div>';
content += response[i].title;
content += '</div></div><div class="column"><div id="bbody"><p>';
var bodyJson = response[i].body;
$("#bbody").html(bodyJson).text();
$("#bbody").html($("#abody").html(bodyJson)); //THIS LINE
content += '</p></div></div></div>';
}
}
$('#table_item').append(content);
}
});
What I can't do is write the way it's supposed to be, that is bullets and bold: