Passing the parameters through a post request was easier than expected :). <div><div><br></div><div>createBlock: aCreateBlock onSuccess: onSuccessBlock onFail: onFailBlock</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>createBlock := aCreateBlock.</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>createSuccessBlock := onSuccessBlock.</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>createFailBlock := onFailBlock.</div></div><div>
<div>self</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>call: 'bind'</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>with: 'create.jstree'</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>with: ((((JQuery.JQueryClass context: self renderContext) ajax)</div>
<div><span class="Apple-tab-span" style="white-space:pre">                                </span>type: 'POST';</div><div><span class="Apple-tab-span" style="white-space:pre">                                </span>addParameters: ((Grease.GRSmallDictionary new)</div><div>
<span class="Apple-tab-span" style="white-space:pre">                                                        </span>at: 'id' put: (JSStream on: 'data.rslt.parent.attr("id")');</div><div><span class="Apple-tab-span" style="white-space:pre">                                                        </span>at: 'position' put: (JSStream on: 'data.rslt.position');</div>
<div><span class="Apple-tab-span" style="white-space:pre">                                                        </span>at: 'title' put: (JSStream on: '<a href="http://data.rslt.name">data.rslt.name</a>');</div><div><span class="Apple-tab-span" style="white-space:pre">                                                        </span>at: 'type' put: (JSStream on: 'data.rslt.obj.attr("rel")');</div>
<div><span class="Apple-tab-span" style="white-space:pre">                                                        </span>yourself);</div><div><span class="Apple-tab-span" style="white-space:pre">                                </span>callback: </div><div><span class="Apple-tab-span" style="white-space:pre">                                                </span>[| request |</div>
<div><span class="Apple-tab-span" style="white-space:pre">                                                </span>request := self requestContext request.</div><div><span class="Apple-tab-span" style="white-space:pre">                                                </span>Transcript</div><div><span class="Apple-tab-span" style="white-space:pre">                                                        </span>cr;</div>
<div><span class="Apple-tab-span" style="white-space:pre">                                                        </span>show: request fields printString])</div><div><span class="Apple-tab-span" style="white-space:pre">                                        </span>asFunction: #(#e #data))</div><div><br>
All there is left is to actually do something with the data :) . </div><div><br></div><div>Does anyone have some tips and hints to improve this method? </div><div><br></div><div>Regards,</div><div><br></div><div>Bart</div>
<div><br><div class="gmail_quote">2010/7/25 Lukas Renggli <span dir="ltr"><<a href="mailto:renggli@gmail.com">renggli@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Yeah, you are right. Probably the Smalltalk code attaches all data to<br>
the query parameters and not to the post data. I don't have a computer<br>
to verify, but if so that should be changed.<br>
<font color="#888888"><br>
Lukas<br>
</font><div><div></div><div class="h5"><br>
On Sunday, July 25, 2010, Bart Veenstra <<a href="mailto:bart.veenstra@gmail.com">bart.veenstra@gmail.com</a>> wrote:<br>
> 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.<br>
> 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.<br>
><br>
> 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?<br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
> 2010/7/25 Lukas Renggli <<a href="mailto:renggli@gmail.com">renggli@gmail.com</a>><br>
> Is there a reason why Seaside doesn't accept a POST-ed Ajax request?<br>
> At least in Pharo it doesn't matter if you do your Ajax requests with<br>
> GET (html jQuery get) or POST (html jQuery post).<br>
><br>
> Lukas<br>
><br>
> On 25 July 2010 18:39, Bart Veenstra <<a href="mailto:bart.veenstra@gmail.com">bart.veenstra@gmail.com</a>> wrote:<br>
>> Hi,<br>
>> I am using Seaside 3.0 which is included in the VW7.7 image and am trying to<br>
>> create a JQPlugin for jstree (<a href="http://www.jstree.com/demo" target="_blank">http://www.jstree.com/demo</a>).<br>
>> I got the basic functionality working on the tree, but now I would like to<br>
>> have the user create new nodes in the tree using hte context menu.<br>
>> JSTree offers this functionality by binding a function to a create node<br>
>> event.<br>
>> (php example)<br>
>> .bind("create.jstree", function (e, data) {<br>
>> $.post(<br>
>> "./server.php",<br>
>> {<br>
>> "operation" : "create_node",<br>
>> "id" : data.rslt.parent.attr("id").replace("node_",""),<br>
>> "position" : data.rslt.position,<br>
>> "title" : <a href="http://data.rslt.name" target="_blank">data.rslt.name</a>,<br>
>> "type" : data.rslt.obj.attr("rel")<br>
>> },<br>
>> function (r) {<br>
>> if(r.status) {<br>
>> $(data.rslt.obj).attr("id", "node_" + <a href="http://r.id" target="_blank">r.id</a>);<br>
>> }<br>
>> else {<br>
>> $.jstree.rollback(data.rlbk);<br>
>> }<br>
>> }<br>
>> );<br>
>> })<br>
>> In this javascript example, the parameters are sent to the server using a<br>
>> JQuery Post. The second function takes care of the result and does a<br>
>> rollback if the creation failed.<br>
>> I want to have the the same functionality in seaside like this:<br>
>> ((html jQuery id: treeId) tree)<br>
>> plugins: #('json_data' 'themes' 'ui' 'contextmenu' 'dnd');<br>
>> getChildrenBlock: [:node | self getChildren: node];<br>
>> theme: 'default';<br>
>> types: self treeTypes;<br>
>> animation: 0;<br>
>> createBlock: [:node :position :title :type | ] onSuccess: [:node :s |<br>
>> ] onFail: [:ex :s | ]<br>
>> The createBlock first argument holds the seaside translated objects from the<br>
>> javascript call, the second should be executed when the first block executes<br>
>> correctly and the third should be executed when the command failed. The<br>
>> onSuccessBlock should also hold the newly created node and a script to do<br>
>> something wiht the newly created node.<br>
>> What is the best way to accomplish this using a post call instead of a get<br>
>> call? I probably could get this running with a normal GET jquery callback,<br>
>> but I am worried about the length of the get request when using proxies who<br>
>> cut off long urls (this happens quite a lot unfortunatly)<br>
>> I hope anyone could push me in the right direction.<br>
>> Regards,<br>
>><br>
>> Bart Veenstra<br>
>><br>
>> _______________________________________________<br>
>> seaside mailing list<br>
>> <a href="mailto:seaside@lists.squeakfoundation.org">seaside@lists.squeakfoundation.org</a><br>
>> <a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside" target="_blank">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a><br>
>><br>
>><br>
><br>
><br>
><br>
> --<br>
> Lukas Renggli<br>
> <a href="http://www.lukas-renggli.ch" target="_blank">www.lukas-renggli.ch</a><br>
> _______________________________________________<br>
> seaside mailing list<br>
> <a href="mailto:seaside@lists.squeakfoundation.org">seaside@lists.squeakfoundation.org</a><br>
> <a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside" target="_blank">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a><br>
><br>
><br>
><br>
<br>
</div></div>--<br>
<div><div></div><div class="h5">Lukas Renggli<br>
<a href="http://www.lukas-renggli.ch" target="_blank">www.lukas-renggli.ch</a><br>
_______________________________________________<br>
seaside mailing list<br>
<a href="mailto:seaside@lists.squeakfoundation.org">seaside@lists.squeakfoundation.org</a><br>
<a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside" target="_blank">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a><br>
</div></div></blockquote></div><br></div></div>