I do not understand the nature of your question, but I'll attempt an
answer.
RPN's use of the input field is a theory, more or less. Since the
model binder will bind to input fields, it stands to logically reason
that if you bind an invisible input field to a collection that gets
JSON serialized, and the model binder can deserialize the json result,
then it will work on normal model binding postback without using the
$.ajax or ko.utils.postJson functions.
As for why you would want to post instead of ajax, there are a lot of
reasons.
1. Very often you want to redirect someone after posting. This is
obnoxious to do in ajax when you can do it so much more easily with
"return RedirectToAction". It becomes more valuable to do it in the
controller if you have to redirect based on the parameters passed.
2. Sometimes you do not get results instantly. It is not unthinkable
to imagine that an object submitted by a Knockout viewModel will go
into a queue where it will be pushed into a database later. Imagine if
you are a massive site and handle millions of requests, demanding the
database for every one of them would be stupid. You would create a
queue and flush them to the database when it was convenient and cost
effective.
3. ajax posting can interfere with certain security protocols like the
[ValidateAntiforgeryToken] filter and HttpModules that monitor
postback to prevent redundant postback (I myself had to write just
such a module to stop a user from hammering the submit button over and
over and slipping past SERVER side validation. (Yes, you can slip past
server side validation if you smash the submit button fast enough))
There are others, but these are the three I could think of off the top
of my head.
On Jun 16, 7:42 am, Kalman Speier <
kalman.spe...@gmail.com> wrote:
> Ok fair enough and what is the reason of use an input field?
>