So I do this post:
$http.post(Common.blog.save, { blog: blog })
.then(saveBlogComplete)
.catch(function(message) {
});
And I get this in fiddler output:
{"blog":{"title":"Chicken Is Good","content":"#Chicken Is Good\n##Contents\n* Introduction\n* Factfile\n* Analysis\n* Evaluation\n* Conclusion\n###Introduction\n\n###Factfile","dateAuthored":"","userId":""}}
In my action:
[HttpPost]
public JsonResult Save(string blog)
{
var desBlog = JsonConvert.DeserializeObject<BlogDto>(blog);
return this.ExecuteService(() => this.blogService.Save(desBlog));
}
string blog is coming back null.... I'm not sure why this is happening?
I have done the following
- Put breakpoint in JavaScript - data is getting populated
- Reviewed Fiddler output - the data is the same as JavaScript obj
- Put breakpoint in the Action - it's getting called, the HttpContext doesn't have any data about the POST data in it
{blog: JSON.stringify(blog)}(uses the JSON2 js library)