I am trying to bind JSON data returned from a ASP.Net web service to table, but could not do so.
Here is the code. where i am going wrong ?
var template = kendo.template($("#template").html());
var dataSource = new kendo.data.DataSource({
transport: {
read: {
type: "POST",
url: "http://localhost:52300/WebService1.asmx/Movie",
contentType: 'application/json; charset=utf-8',
dataType: "json"
}
}
});
dataSource.bind("change", function () {
$("#movies tbody").html(kendo.render(template, dataSource.view()));
});
dataSource.read();
Where as template is ,
<script id="template" type="text/x-kendo-template">
<tr>
<td>#= Rank #</td>
<td>#= Rating #</td>
<td>#= Year #</td>
<td>#= Title #</td>
</tr>
</script>
and web service us showing following data ,
<string xmlns="http://tempuri.org/">[{"Rank":5,"Rating":9,"Year":1995,"Title":"Titanic"},{"Rank":2,"Rating":5,"Year":1964,"Title":"Scent "}]</string>
any help please ?
Here is the code. where i am going wrong ?
var template = kendo.template($("#template").html());
var dataSource = new kendo.data.DataSource({
transport: {
read: {
type: "POST",
url: "http://localhost:52300/WebService1.asmx/Movie",
contentType: 'application/json; charset=utf-8',
dataType: "json"
}
}
});
dataSource.bind("change", function () {
$("#movies tbody").html(kendo.render(template, dataSource.view()));
});
dataSource.read();
Where as template is ,
<script id="template" type="text/x-kendo-template">
<tr>
<td>#= Rank #</td>
<td>#= Rating #</td>
<td>#= Year #</td>
<td>#= Title #</td>
</tr>
</script>
and web service us showing following data ,
<string xmlns="http://tempuri.org/">[{"Rank":5,"Rating":9,"Year":1995,"Title":"Titanic"},{"Rank":2,"Rating":5,"Year":1964,"Title":"Scent "}]</string>
any help please ?