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 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Sundaram SubramanianRank #150 · 15.2K reputationPosted Jun 29, 2017, 3:53 AM EDT
Abhilash J ARank #1,243 · 1.4K reputationPosted Jun 29, 2017, 8:06 AM EDT
$(tb_employee)should be$('#tb_employee')Abhilash J ARank #1,243 · 1.4K reputationPosted Jun 29, 2017, 8:27 AM EDT
A way to create and append a new row is:
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questionsTop experts