I have some code like:
$.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 returns a boolean. I thought I could test the return value as above but it isn’t working. Anyone know what I’m doing wrong?
'false'is a non-empty string which evaluates totrue. Try usingfalse(no quotes), or use developer tools (like Firebug) to inspect the value ofdatato see what is actually being returned.