I am using jsView (v1.0.0-alpha)
I am having an issue in getting the data from the view. Let's I have the following code. (I created a simplified version here http://jsfiddle.net/j5oc0svg/ ) I am trying to get the data object that I bind to the view earlier by using the place holder name. It's always return 'undertified'. If I called $.view().views then I can see the view and the data that I bind earlier.
How can I get the data that bind to the view by using the placeholder or (view name?)?
Thanks in advance.
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery.js"></script>
<base href="http://www.jsviews.com/samples/"/>
<link href="samples.css" rel="stylesheet"/>
<script src="../download/jsviews.js"></script>
</head>
<body>
<table><tbody id="peopleList"></tbody></table>
<script id="personTmpl" type="text/x-jsrender">
<tr>
<td>Name</td>
<td>{{:name}}</td>
</tr>
</script>
<script>
$.ajax({
url: "http://localhost:4728/api/People/,
dataType: 'json'
}).done(function (data) {
if (data!= null) {
var template = $.templates("#personTmpl");
template.link("#peopleList", data);
}
}).fail(function (exception) {
console.log(exception.message);
});
// Let's say this code is in button on click or push subscriber
hub_proxy.client.UpdateSomething = function (someArgs) {
var data = $.view('#peopleList').data; //underfined.
}
</script>
</body>
</html>