I have this method in my mvc controller:
public void RejectInvoice(int invoiceId)
{
var invoice = _unitOfWork.InvoiceRepository.Get((int)invoiceId);
invoice.Rejected = true;
invoice.RejectedDateTime = DateTime.Now;
_unitOfWork.InvoiceRepository.InsertUpdate(invoice);
_unitOfWork.Save();
}
In my script file I call it using:
$.post('/Invoice/RejectInvoice/'+ 3, function (data) {
});
In firebug I’m getting:

What the ………..? It clearly shows I’ve provided it with the 3 as a parameter but then claims I’m sending it a null?
can someone tell me what is going on here? How to fix?
The default model binder will bind to a parameter called “id” but your parameter is named invoiceId, so it does not know to bind the value to it. A quick fix would be to change your POST URL to
'/Invoice/RejectInvoice/?invoiceId='+ 3.