0

我有一些代码,例如:

$.post('/Invoice/UpdateFieldUser/', invoiceLine, function (data) {
    if (data == 'false') {
        alert("An approver could not be updated");
    } else {
        var fieldlabel = $('#fieldapprovallabel' + invoiceLineId + '');
        fieldlabel.text($(".fieldapproverddl option:selected").text());
    }
})

UpdateFieldUser 返回一个布尔值。我以为我可以像上面那样测试返回值,但它不起作用。有人知道我在做什么错吗?

4

1 回答 1

4

'false'是一个非空字符串,其计算结果为true. 尝试使用false(不带引号),或使用开发人员工具(如 Firebug)检查 的值data以查看实际返回的内容。

于 2012-04-13T00:27:42.070 回答