Thanks, didn't search the doc at the right place (was looking into
core, that's under ajax).

Why would you question if I really want to do that ? What would be the
reason/risk of doing it ?

X+

On Aug 15, 1:09 am, "Erik Beeson" <[EMAIL PROTECTED]> wrote:
> I question whether or not you really want to be doing that... But here's
> both questions in one go:
>
> if(!$.isFunction($.fn['pluginName'])) {
>   $.getScript('/path/to/plugin', function() {
>     alert('Plugin ready');
>   });} else {
>
>   alert('Plugin ready');
>
> }
>
> That assumes the plugin is on the same domain as the current page. If not,
> getScript won't work, so you'd have to do something like:
>
>   var script = document.createElement('script');
>   script.type = 'text/javascript';
>   script.src = '/path/to/plugin';
>   $('head')[0].appendChild(script);
>
> But then you don't get the nice callback stuff to ensure that it's loaded.
>
> --Erik
>
> On 8/14/07, Benjamin Sterling <[EMAIL PROTECTED]> wrote:
>
>
>
> > Xavier,
> > For question #1:  if(typeof $.fn.tableSorter == 'function')
>
> > question #2: yes, you just need to know the path to the file and do a
> > document.write('<script...
>
> > On 8/14/07, xavier <[EMAIL PROTECTED]> wrote:
>
> > > Hello,
>
> > > I'd like to be able to test if a specific plug in is loaded before
> > > calling some of its properties (to avoid throwing an error).
>
> > > Second question, is it possible to load it if missing ?
>
> > > Use case:
>
> > > I have a bit of template that have a sortable table of users, and
> > > another one that list groups. They both have a sortable table, and
> > > might be included into the same page or used separately.
>
> > > I'd rather not load on all the pages the sortable table plugin, so I
> > > have to be able to detect on each of these template if the plugin is
> > > already loaded or if I have to load it (or not call the .tableSorter()
> > > method).
>
> > > Any suggestion ?
>
> > > Thanks in advance,
>
> > > X+
>
> > --
> > Benjamin Sterling
> >http://www.KenzoMedia.com
> >http://www.KenzoHosting.com

Reply via email to