-1

How do I examine the post data submitted through Ajax request? Is it in the Request object? if yes, which property? Thanks!

Alan Zeng
  • 74
  • 1
  • 7
  • Please give more details and tell me what you tried and what's your problem ? – Ramesh Rajendran Sep 29 '13 at 18:14
  • You'd examine it like the POST data of any other request. It can be in the `Request` object, it can be in MVC action method parameters, in a `FormCollection`, etc. What have you tried? – David Sep 29 '13 at 18:16
  • @RameshRajendran Sorry for not making the question clear. I am using knockout, and asp.net single page application. I called $.ajax(url, options) in my javascript. (where in my options, I have property "data" that's supposed to be an javascript object called Person corresponding to model in my c# code. In my apicontroller PersonController, I have action called PostPerson that takes a Person as an object (Person class defined in Person.cs). The problem is this controller action is never called. Instead, only the dbContext is created and disposed, dummy constructor Person(){} is called. – Alan Zeng Sep 29 '13 at 19:09
  • @David Sorry for not asking clear question. I don't know why my controller action is not called in my apicontroller. The data I passed with Ajax call is not deserialized and mapped into the corresponding object in c# (perhaps), which is Person class. Thus I want to see the data that I passed to server side, see if it's in the right format, or perhaps even null. Thanks – Alan Zeng Sep 29 '13 at 19:14

1 Answers1

0

The POST data is in

Request.Form

http://msdn.microsoft.com/en-us/library/ms525985(v=vs.90).aspx

Wiktor Zychla
  • 47,367
  • 6
  • 74
  • 106