[Seaside] JQuery callbacks using POST with conditional statements

Lukas Renggli renggli at gmail.com
Sun Jul 25 17:29:56 UTC 2010


Yeah, you are right. Probably the Smalltalk code attaches all data to
the query parameters and not to the post data. I don't have a computer
to verify, but if so that should be changed.

Lukas

On Sunday, July 25, 2010, Bart Veenstra <bart.veenstra at gmail.com> wrote:
> I don't know. As far as I know, all callback parameters are passed through in a GEt request when using  callback: [:v ] json: javascript stuff.
> I am trying to figure out how to use html jQuery post, but I am not sure on how to combine it with a callback. The only example i could find of post was in a test class which did nothing more than checking the output of the method.
>
> the JQPost method only takes the arguments complete and dataType but in the JQuery documentation i could also specify a data parameters. Should I use jquery ajax with the post method instead of JQPost?
>
>
>
>
>
>
>
>
> 2010/7/25 Lukas Renggli <renggli at gmail.com>
> 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
> _______________________________________________
> 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