NYCPHP Meetup

NYPHP.org

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

Jon Baer jonbaer at jonbaer.com
Thu May 3 15:10:14 EDT 2007


Send back a 412 (precondition failed) error and evaluate the <script>  
on return w/ all the errors is the only way I can think of unless you  
went w/ your own scheme of parsing + displaying the response ...

- Jon

On May 3, 2007, at 2:55 PM, David Mintz wrote:

> Ah so, makes sense. The thing about the JSON header is nice. But I  
> want to show the each message in a DIV adjacent to the  
> corresponding form element. So sending one HTML fragment of error  
> text wouldn't quite do it.
>
> On 5/3/07, Tim Lieberman <tim_lists at o2group.com> wrote:
> If there are validation errors, send back a json-encoded false in  
> the X-JSON header, and some error HTML to be injected into a DOM  
> element in the body.
>
> If there are no errors, send back a json-encoded true in the X-JSON  
> header, and do whatever else you need in the responseText. [...]
>
> -- 
> David Mintz
> http://davidmintz.org/
>
> Just a spoonful of sugar helps the medicine go down
> In the most delightful way.
> _______________________________________________
> New York PHP Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
>
> NYPHPCon 2006 Presentations Online
> http://www.nyphpcon.com
>
> Show Your Participation in New York PHP
> http://www.nyphp.org/show_participation.php




More information about the talk mailing list