First of all make sure that your server side code is returning correct data. Open any browser's js debugger and look at errors.
I'm not sure what exactly wrong with your code, but I'm made simplified version which works almost the same way as yours. I hope it will help to understand your problem.
HTML:
<ul data-bind="visible: results_page().length > 0, foreach: results_page">
<li>
<span data-bind="text: description"></span>
</li>
</ul>
<ol data-bind="foreach: pages_count()">
<li data-bind="click: $root.load_page.bind($data, $index() + 1)">
<a href="javascript:;" data-bind="text: $index() + 1"></a>
</li>
</ol>
JS:
var ViewModel = {
results_page: ko.observableArray(),
show_result: ko.observable(false),
load_page: function(pageIndex, test) {
// load data by jquery...
var pageData = [
{ description: 'description 1 of page ' + pageIndex },
{ description: 'description 2 of page ' + pageIndex }
];
ViewModel.results_page(pageData);
ViewModel.show_result(pageData.length > 0)
},
pages_count: function() {
return new Array(3);
}
}
ko.applyBindings(ViewModel);