[Seaside] JQuery callbacks using POST with conditional statements

Lukas Renggli renggli at gmail.com
Sun Jul 25 16:46:55 UTC 2010


Is there a reason why Seaside doesn't accept a POST-ed Ajax request?
At least in Pharo it doesn't matter if you do your Ajax requests with
GET (html jQuery get) or POST (html jQuery post).

Lukas

On 25 July 2010 18:39, Bart Veenstra <bart.veenstra at gmail.com> wrote:
> Hi,
> I am using Seaside 3.0 which is included in the VW7.7 image and am trying to
> create a JQPlugin for jstree (http://www.jstree.com/demo).
> I got the basic functionality working on the tree, but now I would like to
> have the user create new nodes in the tree using hte context menu.
> JSTree offers this functionality by binding a function to a create node
> event.
> (php example)
> .bind("create.jstree", function (e, data) {
> $.post(
> "./server.php",
> {
> "operation" : "create_node",
> "id" : data.rslt.parent.attr("id").replace("node_",""),
> "position" : data.rslt.position,
> "title" : data.rslt.name,
> "type" : data.rslt.obj.attr("rel")
> },
> function (r) {
> if(r.status) {
> $(data.rslt.obj).attr("id", "node_" + r.id);
> }
> else {
> $.jstree.rollback(data.rlbk);
> }
> }
> );
> })
> In this javascript example, the parameters are sent to the server using a
> JQuery Post. The second function takes care of the result and does a
> rollback if  the creation failed.
> I want to have the the same functionality in seaside like this:
> ((html jQuery id: treeId) tree)
> plugins: #('json_data' 'themes' 'ui' 'contextmenu' 'dnd');
> getChildrenBlock: [:node | self getChildren: node];
> theme: 'default';
> types: self treeTypes;
> animation: 0;
> createBlock: [:node :position :title :type | ] onSuccess: [:node :s |
> ] onFail: [:ex :s | ]
> The createBlock first argument holds the seaside translated objects from the
> javascript call, the second should be executed when the first block executes
> correctly and the third should be executed when the command failed. The
> onSuccessBlock should also hold the newly created node and a script to do
> something wiht the newly created node.
> What is the best way to accomplish this using a post call instead of a get
> call? I probably could get this running with a normal GET jquery callback,
> but I am worried about the length of the get request when using proxies who
> cut off long urls (this happens quite a lot unfortunatly)
> I hope anyone could push me in the right direction.
> Regards,
>
> Bart Veenstra
>
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>



-- 
Lukas Renggli
www.lukas-renggli.ch


More information about the seaside mailing list