$.Post on ASP.Net MVC 4

17 Mar 2013

Surprised I did not see an example of this on the web but I noticed to use $.post to pass a value to an Action in your controller you need to JSON.stringify on the value to get it to post. Otherwise the value you get in your parameter will be null. See below

 $.post("/GemTable/ProcessBestGem",  { sGems: JSON.stringify(sname) }, function (html) {
// Do Something;
},"json");

Useful to know maybe.

Published on 17 Mar 2013 Find me on Twitter!