我使用function ViewModel() {
var self = this;
self.Organization = ko.observable();
self.TicketCount = ko.computed(function() {
// *** Reading the value, using a local variable to remember it during this call,
// branching if we don't have one y et
var organization = self.Organization();
if (!organization) {
// We don't have one yet
return "-/-";
}
console.log(organization.UniqueICount);
// *** Handling undefined by values via ||
var uniqueOpenICount = organization.UniqueOpenICount || 0;
var uniqueICount = organization.UniqueICount || 0;
console.log(uniqueOpenICount + " / " + uniqueICount); // *** Beware that 0/0 is NaN, and n/0 is Infinity, so
return uniqueOpenICount + " / " + uniqueICount; // *** ...you probably want more logic here
});
}
function SucessFunction(data) {
console.log(data.Organizations[0].UniqueICount);
var newOrganization = new OrganizationObject();
newOrganization.UniqueICount = data.Organizations[0].UniqueICount;
newOrganization.UniqueOpenICount = data.Organizations[0].UniqueOpenICount;
console.log(newOrganization);
// *** Note setting it via call
viewModel.Organization(newOrganization);
// *** Note getting it via call
console.log(viewModel.Organization());
}
对象在VBA中向我的服务器发送HTTP请求。这是我的代码:
MSXML2.ServerXMLHTTP
我的问题是我的data.php,简单地说就是:
Set objHTTP = CreateObject("MSXML2.ServerXMLHTTP")
URL = "http://localhost/data.php"
objHTTP.Open "POST", URL, False
objHTTP.setRequestHeader "Content-type", "application/x-www-form-urlencode"
objHTTP.send ("name=blabla&data=test")
返回"索引未定义"错误。我无法访问参数的任何值。奇怪的是这段代码:
var_dump($_POST['name']);
将var_dump($HTTP_RAW_POST_DATA);
作为字符串返回。但在这种情况下,我将不得不手动解析数据,我真的,真的不想这样做。为什么无法通过$ _POST访问数据?