Hi folks,
I'm trying to access a simple ASP.NET MVC route, but it's erroring with:
The parameters dictionary contains a null entry for parameter 'isFoo' of non-nullable type 'System.Boolean' for method 'System.Web.Mvc.ActionResult Transform(Boolean, System.String)' in .. blah blah blah.
Ie. the boolean property is not getting set ... which means the value is not getting passed in.
So i've got an Action method called Transform(..) and it's not accepting the values that are HTTP-Posted to it, with jQuery. It's like my posted values get lost :(
The MVC site is a stock standard ASP.NET MVC File->New->MVC Web Application. Nothing has been changed, with the exception of adding a new controller class. that's it.
using System.Web.Mvc;
using System.Web.Mvc.Ajax;
namespace WorldDomination.EbonHawk.Web.Controllers
{
public class AjaxController : Controller
{
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Transform(bool isFoo, string bar)
{
// blah....
return View();
}
}
}
and how this is called, using jQuery ....
$.ajax({
type: "POST",
url: "/ajax/transform",
data: "isfoo=true&bar=" + $("#Bar").val(),
contentType: "application/json;",
dataType: "json",
success: function() { alert("it worked"); },
failure: function() { alert("Uh oh"); }
});
When i use FireBug, it definately shows that i'm trying to POST to the url. Can anyone help?