As Norbert just pointed out in the thread "Dynamically Loaded Scripts
in IE 7 - Problems Found and Lessons Learned", it is a scope issue.
If the functions in your script file loaded via getScript use either
of the following two methods (they're synonymous) then the functions
will not be available in the global scope.

function myFunc(){}

var myFunc = function(){}

However, if you define functions like this:

myFunc = function(){} // note the lack of "var"

Then it will be available and work fine.  I've found no fix for this
in jQuery source. For now we just have to be careful of the scripts we
load in.

You can also keep using the first method above and just define the
variable in the global scope earlier in the script file like so:

myFunc = myOtherFunc = {};
function myFunc(){}
etc...

This was tested against SVN jQuery and IE7.

On 11/17/06, Paul McLanahan <[EMAIL PROTECTED]> wrote:
> Found and patched the problem in ajax.js where $.getScript and
> $.getJSON don't do anything if a callback isn't supplied.  The problem
> is that httpData function isn't called from $.ajax unless there is a
> callback supplied. Someone please commit if it's deemed a good fix.
> The only other fix is to add an else after the check for s.success in
> ajax.js on line 778 to look for types that need httpData to run.
> Something like
>
> // If a local callback was specified, fire it
> if ( s.success )
>     s.success( jQuery.httpData( xml, s.dataType ), status );
> else if ( s.dataType=='script' || s.dataType=='json' )
>     jQuery.httpData( xml, s.dataType );
>
> But I think the patch below might be easier... up to you committers.
>
> Index: ajax.js
> ===================================================================
> --- ajax.js     (revision 603)
> +++ ajax.js     (working copy)
> @@ -420,11 +420,7 @@
>          * @cat AJAX
>          */
>         getScript: function( url, callback ) {
> -               if(callback)
> -                       jQuery.get(url, null, callback, "script");
> -               else {
> -                       jQuery.get(url, null, null, "script");
> -               }
> +               jQuery.get(url, null, callback||function(){}, "script");
>         },
>
>         /**
> @@ -465,7 +461,7 @@
>          * @cat AJAX
>          */
>         getJSON: function( url, data, callback ) {
> -               jQuery.get(url, data, callback, "json");
> +               jQuery.get(url, data, callback||function(){}, "json");
>         },
>
>         /**
>
>
> I'm still looking for the IE7 problem.
>
> Paul
>
>
> On 11/17/06, John Resig <[EMAIL PROTECTED]> wrote:
> > I've created a trouble ticket for it here:
> > http://jquery.com/dev/bugs/bug/407/
> >
> > --John
> >
> > On 11/17/06, Andrea Ercolino <[EMAIL PROTECTED]> wrote:
> > >
> > > Hi everybody.
> > >
> > > While developing the PunchCard widget I've found a problem with getScript 
> > > in
> > > IE7.
> > >
> > > If you are interested in helping me, I've isolated the issue here:
> > > http://www.mondotondo.com/aercolino/punchcard/test-getScript-error/
> > >
> > > Thanks
> > > Andrea
> >
> > _______________________________________________
> > jQuery mailing list
> > [email protected]
> > http://jquery.com/discuss/
> >
>

_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to