javascript - jQuery appends blank (nothing) when concatenating -


i have html

<html>   <head>             <script src="js/vendor/jquery-1.10.1.min.js"></script>     <script src="js/rest.js"></script>   </head>   <body>     <table>       <tbody id="list"></tbody>     </table>   </body> </html> 

and js

$(document).ready(function(){ var url = 'js/context.xml' requestxml(url); });  function requestxml(url){     $.ajax({         type: "get",         url: url,         datatype: "xml",         success: function(xml){             var items = $(xml).find('item');             $.each(items, function(){                 var id = $(this).text();                 $('#list').append('<tr>'+id+'</tr>');                 //$('#list').append(id);                             console.log(id);             });                          }     }); } 

when check source generated this, , blank. console shows id. if remove tags shows me ids.

what problem , how fix this.

as tymejv said: put ids <td>s first , <tr>s:

$('#list').append('<tr><td>'+id+'</td></tr>'); 

Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -