Within my asp.net project, I have utilized the following approach to extract Json data from a js file:
var ds = new kendo.data.DataSource({
transport: {
read: {
url: "http://localhost:2544/JS/employee.js", dataType: "jsonp"
}
}
});
ds.read();
alert(ds.view().length);
Unfortunately, this method consistently returns 0 for me. My objective is to retrieve the column values in order to create a graph, but I am struggling to access the actual data.
The json dataset stored in the employee.js file is structured like so:
{
"t1": [
{
"country": "United States",
"year": "19994",
"value": 4.9
},
{
"country": "United States",
"year": "1995",
"value": 9.2
},
------
Furthermore, I have included the necessary scripts within the head section of my page:
<link href="http://cdn.kendostatic.com/2014.2.716/styles/kendo.common.min.css" rel="stylesheet" />
<link href="http://cdn.kendostatic.com/2014.2.716/styles/kendo.default.min.css" rel="stylesheet" />
<link href="http://cdn.kendostatic.com/2014.2.716/styles/kendo.dataviz.min.css" rel="stylesheet" />
<link href="http://cdn.kendostatic.com/2014.2.716/styles/kendo.dataviz.default.min.css" rel="stylesheet" />
<script src="http://cdn.kendostatic.com/2014.2.716/js/jquery.min.js"></script>
<script src="http://cdn.kendostatic.com/2014.2.716/js/angular.min.js"></script>
<script src="http://cdn.kendostatic.com/2014.2.716/js/kendo.all.min.js"></script>