Reputation: 2189
I have text like this generated from flask with query
Predictions: Apple Cedar rust - 99.646: Cedar apple rust is a fungal disease caused by Gymnosporangium juniperi-virginianae that requires juniper plants to
Now I wanted to put this into 2 lines like this
Predictions: Apple Cedar rust - 99.646
Cedar apple rust is a fungal disease caused by Gymnosporangium juniperi-virginianae that requires juniper plants to
Here is my jquery code that generated above output.
var new_data = JSON.parse(data.payload);
$('#result').append('Predictions: ');
for (var i in new_data){
var _html = `
<p>${new_data[i].name}: ${new_data[i].val}</p>
`
$('#result').append(_html);
}
I tried to do this but didn't work.
<p>${new_data[i].name}: "<br />" ${new_data[i].val}</p>
How do I do this?
Upvotes: 1
Views: 1205
Reputation: 21
try this.
var _html = "<p>" + ${new_data[i].name}: ${new_data[i].val} + "</p>";
Upvotes: 2
Reputation: 29
Try this:
<p>
<span style="display:block">${new_data[i].name}:</span> ${new_data[i].val}
</p>
Upvotes: 1