[Seaside] Ajax Callback with Response Code other than 200
Bob Arning
arning315 at comcast.net
Tue Dec 31 19:43:54 UTC 2013
Well, just trying things a bit, this seems to work:
"===================="
html div
onClick: (html jQuery ajax
callback: [ :val |
val inspect.
self requestContext respond: [ :response |
response
contentType: 'text/json' seasideMimeType;
nextPutAll: {'what arrived was'. val} asJson
]
]
value: (JSStream on: 'this.innerHTML')
);
with: 't2'.
"===================="
Cheers,
Bob
On 12/31/13 9:30 AM, jtuchel at objektfabrik.de wrote:
> Hi again,
>
> thinking a bit more about my X-editable plans, I dug a bit deeper into
> JQAjax. Unfortunately, this gives me more questions than answers ;-)
>
> Say I have an ajax callback using jquery like this:
>
> html anchor
> id: 'mylink';
> onClick: (html jQuery ajax callback: [self doSomething]);
> with: 'Click here'.
>
>
> This callback will always respond with an empty HTTP response with
> status code 200, right?
> There are other callback methods on JQAjax, like respond:, text: and
> so on.
>
> Is there any documentation on these?
>
> I am looking for a way to transport some value to a server-side
> callback block and respond with one of these two options:
>
> a) HTTP 200 and a JSON document with success information and probably
> an error message
> b) HTTP 200 if the callback processed without errors, or a different
> HTTP code and some error text in the response's body if there is some
> error during processing the callback
>
> Has anybody done this? Any pointers to more details?
>
> Thanks in advance and happy new year to all Seasiders!
>
> Joachim
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20131231/5052b198/attachment.htm
More information about the seaside
mailing list