Foreach Data Function getAvailableMethods
<!-- ko foreach: { data: getAvailableMethods(), as: 'item' } -->
<label style="position: relative;top: 2px;" data-bind="attr: {'for': item.code}" class="label"><span data-bind="text: item.name"></span></label>
<!-- /ko -->
JS Code
getAvailableMethods: function (methods) {
console.log(methods);
return methods;
},
Currently, there is empty data on initialization ko foreach: { data: getAvailableMethods() But i want to populate the data every time variable methods gets updated How can i apply the binding of function getAvailableMethods() with variable methods ?
JS Code
'use strict';
var methods = '';
getPaymentMethodLists: function () {
$.ajax({
success: function (data) {
methods = data.methods
}
},