我想从cshtml解析foreach参数。使用foreach from
knockout.js
<div data-bind="foreach: viewPjsp(1)">
.
Javascipt:
function ColumnInput(Id, NameColumn) {
var self;
self = this;
self.Id = ko.observable(Id || null);
self.NameColumn = ko.observable(NameColumn || null);
}
(function () {
'use strict';
function ElicensingPjspViewModel() {
var self = this;
self.viewPjsp = ko.observableArray([]);
self.getViewPjsp = function (data, event) {
var url;
$.ajax({
type: "GET",
url: $.rootDir + 'PJSP/PjspEvaluationDetail?AspectId=1', --> here parameter I want to parsing
success: function (data) {
var result;
console.log(data);
result = ko.utils.arrayMap(data.permission, function (item) {
return new KolomInput(item.Id, item.NameColumn);
});
self.viewPjsp(result);
},
error: function (xhr) {
alert(xhr.responseText);
}
});
};
self.getViewPjsp();
}
ko.applyBindings(new ElicensingPjspViewModel(), document.getElementById('pjsp_prinsipal'));
}());
这个
Javascript
尚未使用参数。如何调用viewpjsp(1),然后使用参数发送到ajax中的url
?AspectId=xxxx
. 如何将参数knockout从html传递到javascript