NYCPHP Meetup

NYPHP.org

[nycphp-talk] AJAX and State

Dell Sala dell at sala.ca
Wed Sep 5 11:52:06 EDT 2007


On Sep 5, 2007, at 11:20 AM, tedd wrote:

> Just keep the user entering data until the data is correct, then  
> submit the form via ajax or as one normally would via a form submit.
>
> So, I don't see the ajax advantage here.

The problem with what you're describing is that all your form  
validation code (business logic) is deployed to the browser as  
javascript. For serious applications, the server cannot rely on the  
client to take care of things like validation, because they can  
easily be bypassed.

What ajax allows you to do is keep the heavy lifting business logic  
on the server (where it belongs), but have your web page change it's  
own state without having to ask the server to redraw an entire  
document every time it needs some new information, or a calculation  
performed.

For example: you could authenticate a user without having to refresh  
the page. There is no way to do that without asking the server to  
verify credentials. Ajax (or some other kind of remoting) is required  
if you want to avoid a page refresh.

-- Dell




More information about the talk mailing list