NYCPHP Meetup

NYPHP.org

[nycphp-talk] Ajax 101: what to return from a POST

David Mintz vtbludgeon at gmail.com
Thu May 3 15:48:58 EDT 2007


Yes, I got the part about the HTTP response code.

I am trying to pose a question about what else to do  if validation fails,
i.e., req.status == 412:  send back the redrawn form w/ errors and display
it, or send back just the validation error messages as a JSON object and
work with that?

On 5/3/07, Felix Shnir <felix.shnir at gmail.com> wrote:
>
> Jon means that the response status should be 412...
>
>         var req = this.getTransport();
>         req.open('POST', uri, true);
>         req.onreadystatechange = function (aEvt) {
>           if (req.readyState == 4) {
>              if(req.status == 200)
>               var r = eval(req.responseText);
>
>                if(req.status == 412)
>                   alert("error has occured: " + req.responseText);
>               }
>           }
>
> Felix
>
>

-- 
David Mintz
http://davidmintz.org/

Just a spoonful of sugar helps the medicine go down
In the most delightful way.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20070503/fe541d05/attachment.html>


More information about the talk mailing list