I have a web service function that returns dataTable... I want to add data from this table1 tags...
<Table1 diffgr:id="Table11" msdata:rowOrder="0">
<ProductID>1</ProductID><ProductName>A</ProductName><AvailableProduct>8</AvailableProduct>
</Table1>
<Table1 diffgr:id="Table12" msdata:rowOrder="1">
<ProductID>2</ProductID><ProductName>B</ProductName><AvailableProduct>3</AvailableProduct>
</Table1>
<Table1 diffgr:id="Table13" msdata:rowOrder="2">
<ProductID>3</ProductID><ProductName>C</ProductName><AvailableProduct>7</AvailableProduct>
</Table1>
<Table1 diffgr:id="Table14" msdata:rowOrder="3">
<ProductID>4</ProductID><ProductName>D</ProductName><AvailableProduct>0</AvailableProduct>
</Table1>
<Table1 diffgr:id="Table15" msdata:rowOrder="4">
<ProductID>5</ProductID><ProductName>E</ProductName><AvailableProduct>3</AvailableProduct>
</Table1>
<Table1 diffgr:id="Table16" msdata:rowOrder="5">
<ProductID>6</ProductID><ProductName>F</ProductName><AvailableProduct>1</AvailableProduct>
</Table1>
and here is my Jquery Code... this won't append anything to the table how can I solve this
$(document).ready(function () {
$("#Btn").click(function () {
alert();
$.ajax({
type: 'POST',
url: 'WebserviceDS.asmx/GetTable',
dataType: 'xml',
data:"{}",
Success: function (xml) {
$(xml).find('Table1').each(function () {
$("<tr><td>" + $(xml).find('ProductID').text() + "</td>").appendTo("table");
alert($(xml).find('ProductID').text());
$("<td>" + $(xml).find('ProductName').text() + "</td>").appendTo("table");
$("<td>" + $(xml).find('AvailableProduct').text() + "</td></tr>").appendTo("table");
})
},
error: function (err) {
alert(err);
}
});
return false;
})
})
in these alerts, it won't show anything ..this is my HTML code
<body>
<form id="form1" runat="server">
<div>
<button id="Btn">Click Me</button>
<table>
<tr>
<th>ProductID</th>
<th>ProductName</th>
<th>AvailableProduct</th>
</tr>
</table>
</div>
</form>
</body>
xmlin thesuccesscallback method? Also not it should besuccessnoteSuccess(Assuming) TYPO while posting question