Reputation: 1961
I want to add table on ajax response. But table is not showing on ajax response only contents displayed.
echo $result = "
<tr>
<td> Rates</td>
<td style='font-size:small;'>words</td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td>CHF<td>
<td>".$_SESSION['calculate']['euro']."</td>
</tr>
<tr><td>".$_SESSION['calculate']['filename']."</td>
</tr>
";
ajax on complete
onComplete: function(file, response){
//On completion clear the status
status.text('');
$('<table></table>').appendTo('#files').text(response);
}
Upvotes: 0
Views: 101
Reputation: 12294
$('<table></table>').appendTo('#files').html(response);
You were inserting the table string as a text, not as actual html.
Upvotes: 0
Reputation: 19636
You are printing the result of a variable assignment (TRUE). Try removing the $result =
and just echo the html.
echo "
<tr>
<td> Rates</td>
<td style='font-size:small;'>words</td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td>CHF<td>
<td>".$_SESSION['calculate']['euro']."</td>
</tr>
<tr><td>".$_SESSION['calculate']['filename']."</td>
</tr>
";
Upvotes: 2