Hi,
I need to make an Ajax post using JQuery, with Seaside for my server. I've found a number of Seaside JQuery examples (no posts though) and lots of JQuery post examples (no seaside). In the JQuery examples you specify the URL you're posting to, but that would be wrong in Seaside. Here's the use case. I have a large table of data. Each cell contains an anchor and clicking on the anchor converts the cell to a TextInput field. Now I need to submit that field's value, in an Ajaxy way, so I only refresh the single cell of the table. A simplified version of the current code looks like this: renderContentOn: html | child | child := myTextEditor valueBlock: [ object value ] callback: [ :value | object setValue: value ] html anchor onClick: ((html jQuery this) load html: [ :r | r render: child ]); with: ( object value). I'm assuming the solution involves modifying the callback in my 'child' to post using JQuery. if anyone could explain in a bit more detail what the callback and the server code should look like it would be a big help. PS: It would also make a good addition to Dynamic Web Development with Seaside's draft JQuery chapter so you'd probably be helping a lot of people ;) Thanks much. Larry _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
The child component should have an ajax callback, then. It doesn't need to be in a form necessarily.
It could look something like this: html textInput callback: [:v | self doSomethingWithValue: v ]; onChange:/onBlur:/onEnter: (html jQuery ajax serializeThis). That would serialize it, but I imagine you want it to do something, so you could further modify it this way: html textInput callback: [ ... ]; onEnter: (html jQuery ajax serializeThis onSuccess: (html jQuery ajax script: [:s | s add: (self doSomethingOn: s) ]. RS > Date: Wed, 5 Oct 2011 20:43:40 -0400 > From: [hidden email] > To: [hidden email] > Subject: [Seaside] Ajax Posting with JQuery: An example? > > Hi, > > I need to make an Ajax post using JQuery, with Seaside for my server. > I've found a number of Seaside JQuery examples (no posts though) and > lots of JQuery post examples (no seaside). In the JQuery examples you > specify the URL you're posting to, but that would be wrong in Seaside. > > Here's the use case. I have a large table of data. Each cell contains > an anchor and clicking on the anchor converts the cell to a TextInput > field. Now I need to submit that field's value, in an Ajaxy way, so I > only refresh the single cell of the table. > > A simplified version of the current code looks like this: > > renderContentOn: html > | child | > child := myTextEditor > valueBlock: [ object value ] > callback: [ :value | object setValue: value ] > > html anchor > onClick: ((html jQuery this) load html: [ :r | r render: child ]); > with: ( object value). > > I'm assuming the solution involves modifying the callback in my > 'child' to post using JQuery. if anyone could explain in a bit more > detail what the callback and the server code should look like it would > be a big help. > > PS: It would also make a good addition to Dynamic Web Development with > Seaside's draft JQuery chapter so you'd probably be helping a lot of > people ;) > > Thanks much. > > Larry > _______________________________________________ > seaside mailing list > [hidden email] > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
That was just the help I needed. Thanks!
On Wed, Oct 5, 2011 at 10:51 PM, Robert Sirois <[hidden email]> wrote: > The child component should have an ajax callback, then. It doesn't need to > be in a form necessarily. > It could look something like this: > html textInput > callback: [:v | self doSomethingWithValue: v ]; > onChange:/onBlur:/onEnter: (html jQuery ajax serializeThis). > That would serialize it, but I imagine you want it to do something, so you > could further modify it this way: > html textInput > callback: [ ... ]; > onEnter: (html jQuery ajax serializeThis onSuccess: (html jQuery ajax > script: [:s | s add: (self doSomethingOn: s) ]. > RS >> Date: Wed, 5 Oct 2011 20:43:40 -0400 >> From: [hidden email] >> To: [hidden email] >> Subject: [Seaside] Ajax Posting with JQuery: An example? >> >> Hi, >> >> I need to make an Ajax post using JQuery, with Seaside for my server. >> I've found a number of Seaside JQuery examples (no posts though) and >> lots of JQuery post examples (no seaside). In the JQuery examples you >> specify the URL you're posting to, but that would be wrong in Seaside. >> >> Here's the use case. I have a large table of data. Each cell contains >> an anchor and clicking on the anchor converts the cell to a TextInput >> field. Now I need to submit that field's value, in an Ajaxy way, so I >> only refresh the single cell of the table. >> >> A simplified version of the current code looks like this: >> >> renderContentOn: html >> | child | >> child := myTextEditor >> valueBlock: [ object value ] >> callback: [ :value | object setValue: value ] >> >> html anchor >> onClick: ((html jQuery this) load html: [ :r | r render: child ]); >> with: ( object value). >> >> I'm assuming the solution involves modifying the callback in my >> 'child' to post using JQuery. if anyone could explain in a bit more >> detail what the callback and the server code should look like it would >> be a big help. >> >> PS: It would also make a good addition to Dynamic Web Development with >> Seaside's draft JQuery chapter so you'd probably be helping a lot of >> people ;) >> >> Thanks much. >> >> Larry >> _______________________________________________ >> seaside mailing list >> [hidden email] >> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside > > _______________________________________________ > seaside mailing list > [hidden email] > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside > > seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
No problem. I'll just add that there's plenty of ways you can chain and link events, but you wanna make sure you serialize first so the data is there. I just happen to like the (latter) method. It works for me.
RS > Date: Thu, 6 Oct 2011 21:54:44 -0400 > Subject: Re: [Seaside] Ajax Posting with JQuery: An example? > From: ljw1001@gmail.com > To: seaside@lists.squeakfoundation.org > > That was just the help I needed. Thanks! > > On Wed, Oct 5, 2011 at 10:51 PM, Robert Sirois <watchlala@hotmail.com> wrote: > > The child component should have an ajax callback, then. It doesn't need to > > be in a form necessarily. > > It could look something like this: > > html textInput > > callback: [:v | self doSomethingWithValue: v ]; > > onChange:/onBlur:/onEnter: (html jQuery ajax serializeThis). > > That would serialize it, but I imagine you want it to do something, so you > > could further modify it this way: > > html textInput > > callback: [ ... ]; > > onEnter: (html jQuery ajax serializeThis onSuccess: (html jQuery ajax > > script: [:s | s add: (self doSomethingOn: s) ]. > > RS > >> Date: Wed, 5 Oct 2011 20:43:40 -0400 > >> From: ljw1001@gmail.com > >> To: seaside@lists.squeakfoundation.org > >> Subject: [Seaside] Ajax Posting with JQuery: An example? > >> > >> Hi, > >> > >> I need to make an Ajax post using JQuery, with Seaside for my server. > >> I've found a number of Seaside JQuery examples (no posts though) and > >> lots of JQuery post examples (no seaside). In the JQuery examples you > >> specify the URL you're posting to, but that would be wrong in Seaside. > >> > >> Here's the use case. I have a large table of data. Each cell contains > >> an anchor and clicking on the anchor converts the cell to a TextInput > >> field. Now I need to submit that field's value, in an Ajaxy way, so I > >> only refresh the single cell of the table. > >> > >> A simplified version of the current code looks like this: > >> > >> renderContentOn: html > >> | child | > >> child := myTextEditor > >> valueBlock: [ object value ] > >> callback: [ :value | object setValue: value ] > >> > >> html anchor > >> onClick: ((html jQuery this) load html: [ :r | r render: child ]); > >> with: ( object value). > >> > >> I'm assuming the solution involves modifying the callback in my > >> 'child' to post using JQuery. if anyone could explain in a bit more > >> detail what the callback and the server code should look like it would > >> be a big help. > >> > >> PS: It would also make a good addition to Dynamic Web Development with > >> Seaside's draft JQuery chapter so you'd probably be helping a lot of > >> people ;) > >> > >> Thanks much. > >> > >> Larry > >> _______________________________________________ > >> seaside mailing list > >> seaside@lists.squeakfoundation.org > >> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside > > > > _______________________________________________ > > seaside mailing list > > seaside@lists.squeakfoundation.org > > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside > > > > > _______________________________________________ > seaside mailing list > seaside@lists.squeakfoundation.org > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Free forum by Nabble | Edit this page |