Hi, Eric...

Can you give me an actual working example of how you include
you're using $getScript to include jQ/js files dyanamically
as you need them?

I need to get some system of code management working that just
including it all the in the page at once.  I think if I can get
code into various templates for includes, I can better think
about what my code is doing rather than scrolling up and down
pages, trying to track functions and variables and HTML changes, etc.,
all on one page.

Thanks,

Rick

-----Original Message-----
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of Eric Garside
Sent: Thursday, April 09, 2009 7:46 PM
To: jQuery (English)
Subject: [jQuery] Re: Managing scripts in AJAX applications


I put together a pretty basic DOMBuilder tool for this purpose, called
HSJN (HTML Snippet Javascript Notation). You can view/get the source
here: http://code.google.com/p/hsjn

It gives you the ability to specify jQuery chains within it's syntax,
and will parse it out into dom nodes you can insert.

As for the managing scripts, I tend to include what I need when I need
it. Any basic page will only include javascript required for initial
functionality. If I then want to create, on the fly, a tabbed area, I
will use:

$.getScript() to include the Javascript I need if I haven't, then
perform my AJAX call when it's done.

Something like:

function tabbedInterface(){
  if ($.fn.tabs) loadAjax();
  else $.getScript('/path/to/tabs', function(){ loadAjax() });
}

That's not an actual implementation, more of a pseudo-code to
illustrate the idea.
On Apr 9, 7:30 pm, JBeckton <jbeck...@gmail.com> wrote:
> Hey...
>
> I am using ColdFusion as well on the FuseBox Framework.
>
> I have somewhat of a slick way to handle the js resources, it was
> great at first but the more screen/interfaces I have the more
> difficult it becomes to manage the js. I basically have a .cfm page
> with html and dynamic data with none of the HTML Doc tags, that I pull
> in via AJAX and inject into a div. I use get jQuery.getScript( url,
> callback ) to pull the supporting script in for the HTML I got from
> the server.
>
> I'de be interested in learning how your transferring variables between
> functions.
>
> Thanks
>
> On Apr 2, 5:39 am, "Rick Faircloth" <r...@whitestonemedia.com> wrote:
>
> > Hi, JMan...
>
> > Did you get any answers to your questions?
>
> > I've been working a lot with jQuery/ajax/ColdFusion
> > lately.  It's all new to me and I've been learning a lot.
> > Perhaps some of what I've learned may be of use to you.
>
> > I haven't been injecting HTML into the DOM of the ajax
> > calling page, but creating HTML to display ajax results.
>
> > And I've also learned some about being able to transfer
> > variables between functions.
>
> > Does any of this sound like what you're looking for?
>
> > Let me know.  I'll be glad to share some code samples
> > with you.
>
> > What's you backend language?
>
> > Rick
>
> > -----Original Message-----
> > From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
>
> > Behalf Of JMan
> > Sent: Wednesday, April 01, 2009 1:40 PM
> > To: jQuery (English)
> > Subject: [jQuery] Managing scripts in AJAX applications
>
> > One thing I have been struggling with is AJAX applications is managing
> > the js code that powers them.
>
> > For example if you have a page that loads content from an AJAX call to
> > the server and that content also has js code associated with it in
> > order to function how do I manage that code? If I have 20 pages that
> > get loaded from the server via AJAX at one point or another I do not
> > want to have one huge js file with a bunch of code for each page in
> > it.
>
> > I was wondering if it's better to embed the js for each page loaded
> > via AJAX or call it separately? Normally when I need chunks of HTML &
> > js, like a data grid for example; that get loaded in via AJAX call I
> > do not have this called code in the traditional HTML doc, in other
> > words the HTML being loaded has no HTML head, body etc.. it's just
> > HTML generated by the server and injected into a section of the
> > calling page. So in this situation should I load the script that is
> > required by the HTML via the success callback?
>
> > Another delima is communicating events and such between chunks of
> > loaded HTML/js, like if I have a Tabs widget and an accordion on the
> > same page and each have content loaded via AJAX and the content in tab
> > 1 needs to bind and interact with events in a section of the accordion
> > content loaded via AJAX.

Reply via email to