Dan Richman wrote:
> Is the onShow callback in place of the ajax parameter passed to .jqm ?
>
> Or something like this?
>
> onShow: function() { myUrl = document.foo.bar.value; },
> ajax: 'myscript.cgi?q=' + myUrl ,
>
> I really appreciate the help.  I'm a perl guy trying to muddle my way thru.

Dan,

  You bring up an interesting point. It would be convenient in this
case to have onShow execute before the ajax load, however the current
version of jqModal does not do this.

  onShow is executed just before the modal window becomes visible. It
is intended as a way to add a fancy display effects (e.g. a fade-ins,
animation, etc.) to the modal -- but also provides a general means to
inject customized behavior (like a special ajax call).

  So in this case we'll include the ajax call in the callback and
display the window.

  E.g.

$(e).jqm({
    onShow: function(hash) {
        myUrl = document.foo.bar.value;
        hash.w.load(myscript.cgi?q=' + myUrl);
        h.w.show();
    },
    ajax: false
});
// notice we get rid of the ajax param, as a custom ajax routine is
used in the onCallback.


While the above works.. in your case it may not be the most convenient/
intuitive at first. I think I *may* add another callback to jqModal
whenever I get around to writing new documentation and examples :)

This callback would be named "beforeLoad", and would be executed
before the ajax call, allowing to override the ajax URL in the way you
mentioned above (changing the value of a global just before the call).

Another idea is to allow you to pass a function as the ajax param
which returns the URL.

e.g.

$(e).jqm({ajax: function() { return document.foo.bar.value; });

In any case... better documentation must be written! :)

Thanks,

~ Brice

Reply via email to