AJAX and FPCGI

Fairlight fairlite at fairlite.com
Thu May 21 07:26:18 PDT 2009


On Thu, May 21, 2009 at 07:13:43AM -0700, after drawing runes in goat's blood,
Tyler cast forth these immortal, mystical words:
> It is easy to use fpCGI with AJAX.  I use it to send JSON formatted data
> back and forth all the time.

And you're doing what for the response MIME types?  Because unless the
server response type is correct, browsers tend to have problems with
XMLHTTPResponse objects, and there is no way to make fPCGI change the MIME
type in the response header.

Maybe JSON is more lax about its types, but good luck with XML being
handled properly by the classes meant to parse the data in the object if
you don't do it the way it should be done.  IE just likes to throw up a
cryptic "Error", and even Firefox is pretty cryptic about what's going
on--although it at least Firebug lets you see the cause of the issue.
Sounds like (since you were using an external JSON class) it doesn't really
care what the response format is, since the browser built-in classes don't
have to deal with it.  I guarantee that's not the case with traditional
XML-based AJAX using the browser's object handling classes.

And of the people doing AJAX, I'd probably guess >75% use XML, not JSON.

The fact remains, fPCGI isn't designed to do AJAX properly.  That you can
trick it in one particular case doesn't make it correct for all cases.

mark->


More information about the Filepro-list mailing list