employee.xml
script_tbemployeedetails.js
$(document).ready(function(){
$.ajax({
type:'GET',
url:'employee.xml',
dataType:'xml',
success:function(xmlData){
$("Employee",xmlData).each(function(){
String name=$(this).find("Name").text(),
String id=$(this).find("ID").text(),
String designation=$(this).find("Designation").text();
$(tb_employee).append('');
$(tb_employee).append(''+name+' ');
$(tb_employee).append(''+id+' ');
$(tb_employee).append(''+designation+' ');
$(tb_employee).append(''); Extract and Read XML Data Using jQuery and Ajax
});
)}
});
}
defaut.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="EmployeeDetails_XML._Default" %>
| NAME | ID | DESIGNATION |
|---|
This is my code.I could not pull xml data into html table
Can anyone help to do this
3 Replies
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Abhilash J APosted Jun 29, 2017, 12:27 PM
A way to create and append a new row is:
Abhilash J APosted Jun 29, 2017, 12:06 PM
$(tb_employee)should be$('#tb_employee')Sundaram SubramanianPosted Jun 29, 2017, 7:53 AM