function OnSuccess(xml) {
document.getElementById("people").innerHTML = "<tr><td>Employee ID</td><td>First Name</td><td >Last Name</td></tr>";
$(xml).find('Table').each(function () {
var id = $(this).find('EmployeeID').text();
var fn = $(this).find('FirstName').text();
var ln = $(this).find('LastName').text();
//Create button
var btn = document.createElement("input");
//Set the attributes
btn.setAttribute("onclick", "ServiceCall3(id)");
btn.setAttribute("type", "button");
btn.setAttribute("value", "Info");
btn.setAttribute("name", id);
$('#people').append('<tr><td>' + id + '</td><td>' + fn + '</td><td>' + ln + '</td><td> '+ btn + '</td></tr>')
}
)};
Hey, this is my function which is creating a table from xml file. What I need is to add a button with id same as read parameter from xml, a the end of each row. What I am getting instead of a button is [object HTMLInputElement]. Please help.
Great, fast response. Can you tell me now how can I pass id value to ServiceCall3 ? or use it in ServiceCall3 ?
function serviceCall3(id) {
$.ajax({
type: "POST",
url: "../TestWebService.asmx/GetAll",
data: "{'data' :" + id + "}",
contentType: "application/json; charset=utf-8",
dataType: "xml",
success: OnSuccess3,
error: OnError
});
}
//Create buttoncommentbtn.setAttribute("onclick", "ServiceCall3("+id+")");?