I'm pretty sure I'm missing it, but where is the documentation about
the second parameter to the AJAX callbacks please?
The second parameter contains the headerJSON value (or null).
Has this facility been dropped?
http://api.prototypejs.org/ajax/ajax/request/ (scroll down to
Evaluating JSON headers) doesn't mention it.
It is mentioned on http://api.prototypejs.org/ajax/ajax/responders
So, for example, what happens for onSuccess() ?
As far as I can tell, it works just the same.
Regards,
Richard.
--
-----
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling
I may be misunderstanding what you are asking, but the documentation
doesn't mention a second parameter. Rather, it says the headerJSON is
a property on the first parameter passed into your onSuccess/onFailure
methods.
Hope that helps!
Allen Madsen
http://www.allenmadsen.com
> --
> You received this message because you are subscribed to the Google Groups "Prototype: Core" group.
> To post to this group, send email to prototy...@googlegroups.com
> To unsubscribe from this group, send email to prototype-cor...@googlegroups.com
> For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en
Allen,
From http://api.prototypejs.org/ajax/ajax/responders :
"The callbacks for responders are similar to the callbacks described
in the Ajax section, but take a different signature. They're invoked
with three parameters: the requester object (i.e., the corresponding
"instance" of Ajax.Request), the XMLHttpRequest object, and the result
of evaluating the X-JSON response header, if any (can be null). They
also execute in the context of the responder, bound to the this
reference."
but the normal callbacks are only documented with the response parameter.
Tobie,
Where?
Current git trunk still has it that the second parameter is response.headerJSON
http://github.com/sstephenson/prototype/blob/master/src/ajax/request.js#L293
(onXYZ, onSuccess/onFailure dispatch)
http://github.com/sstephenson/prototype/blob/master/src/ajax/request.js#L307
(Responder dispatching)
It may be just a case of the code and the documentation not agreeing
and no comments saying that the second parameter is deprecated.
This whole exercise has been useful though.
I didn't quite get the difference between headerJSON and responseJSON.
Both of which are extremely useful.
headerJSON for the status (data retrieved, errors, etc.) and
responseJSON the the content (data, error messages, etc.) from the
server side app.
Excellent stuff!