Thanks Geoff, We ended up going with your first suggestion as it seems
easier to work. I may have a different issue related to it, so I'll keep
you posted. Once again thanks for the help.


On Tue, Mar 11, 2014 at 10:47 PM, Geoff Callender <
geoff.callender.jumpst...@gmail.com> wrote:

> Hi George,
>
> As I said, I prefer to restrict JS to handling client-user interactions,
> not client-server interactions, and leave Tapestry to do the client-server
> stuff.
>
> However, if you really want your JS to initiate AJAX calls, you can do so
> and still avoid burdening the client with writing markup: use Tapestry's
> t5/core/zone module. Its deferredZoneUpdate(clientId, url) method can send
> an event (as a URL), receive the response, and update zones, etc. all in
> one call. It's used here:
>
>
> http://jumpstart.doublenegative.com.au/jumpstart7/examples/ajax/onevent .
>
> The API is here:
>
>         http://people.apache.org/~hlship/t5api/coffeescript/zone.html
>
> HTH,
>
> Geoff
>
> On 11/03/2014, at 11:56 PM, George Christman wrote:
>
> > Hi guys, if there is a better way to do it, I'm all ears. I wasn't aware
> of
> > a way to use zones inside of a js module. Here is a code snippet of what
> > I'm trying to accomplish. As you can see I'm using pure js, "may be
> > alternate solutions", and I'm trying to inject content into my bootstrap
> > modal component via ajax. This would be accomplish once the dialog box
> has
> > been opened and the user clicks the dialog submit action. This wouldn't
> > submit the form but rather perform an ajax request returning content.
> > Another thought that comes to mind is to maybe write the html in tapestry
> > rather than js so that I can take advantage of tapestries zone's. Either
> > way with js becoming so popular, I'd like to understand the cores of ajax
> > request with tapestry so that I always have that option at my disposal.
> >
> > define(["jquery", "bootstrap/modal"], function($) {
> >
> >    var runDialog;
> >
> >    runDialog = function(spec) {
> >
> >          var $dialog = $("<div class=\"modal fade\" role=\"dialog\">\n\
> >                  <div class=\"modal-dialog\">\n\
> >                    <div class=\"modal-content\">\n\
> >                      <div class=\"modal-header\">\n\
> >                        <a class=\"close\"
> > data-dismiss=\"modal\">&times;</a>\n\
> >                        <h3>Review Warning</h3>\n\
> >                      </div>\n\
> >                      <div class=\"modal-body\"></div>\n\
> >                      <div class=\"modal-footer\">\n\
> >                      </div>\n\
> >                    </div>\n\
> >                  </div>\n\
> >                </div>")
> >                .appendTo($("body"));
> >
> >                $(".modal-footer").append("<button class=\"btn
> > btn-warning\">Continue</button>\n\
> >                    <button class=\"btn btn-default\"
> > data-dismiss=\"modal\">Cancel</button>");
> >
> >                $dialog.on("click", ".modal-footer button:first",
> > function() {
> >                            //ajax request to tapestry requesting
> > modal-body content.
> >                });
> >
> >                $dialog.modal();
> >    };
> >
> >    return runDialog;
> > });
> >
> > Like always, thanks guys.
> >
> >
> > On Tue, Mar 11, 2014 at 4:12 AM, Geoff Callender <
> > geoff.callender.jumpst...@gmail.com> wrote:
> >
> >> I share Lance's preference for generating markup server-side. Have you
> >> considered putting a Zone in the modal and having the server-side return
> >> that instead of a JSONObject?
> >>
> >>
> >> On 11/03/2014, at 7:24 AM, Lance Java wrote:
> >>
> >>> I'm not entirely sure what you're doing but this might help.
> >>>
> >>> http://tapestry-stitch.uklance.cloudbees.net/capturedemo
> >>>
> >>> As you can see, I render a block in an AJAX action and call alert(...).
> >> You
> >>> could do anything you like with the rendered markup.
> >>>
> >>> Note: I hate rendering dom in javascript and always prefer rendering my
> >>> markup serverside. I'm bucking the trend a bit here.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> >> For additional commands, e-mail: users-h...@tapestry.apache.org
> >>
> >>
> >
> >
> > --
> > George Christman
> > www.CarDaddy.com
> > P.O. Box 735
> > Johnstown, New York
>
>


-- 
George Christman
www.CarDaddy.com
P.O. Box 735
Johnstown, New York

Reply via email to