Side navigation
#8487 closed bug (wontfix)
Opened March 09, 2011 09:23PM UTC
Closed March 10, 2011 01:16AM UTC
Last modified March 28, 2011 01:35PM UTC
Cache option for .getScript
Reported by: | rudeboiidevil2k7@hotmail.co.uk | Owned by: | |
---|---|---|---|
Priority: | undecided | Milestone: | 1.next |
Component: | ajax | Version: | 1.5.1 |
Keywords: | Cc: | jaubourg | |
Blocked by: | Blocking: |
Description
From now on, the .getScript function should allow the use of caching, since when using the .getScript uses a simple .get() of a script without caching, so I demand that there should be an option for .getScript to allow caching when being used.
getScript: function( url, callback ) { return jQuery.get( url, undefined, callback, "script" ); },
Should be changed to:
getScript: function( url, cache, callback ) { $.ajax({ type: "GET", url: url, success: callback, dataType: "script", cache: cache }) },
Or anything that the jQuery team should take action onto changing .getScript to be more flexible with options.
Let us see this change to be added into 1.5.2 or the next update!
Just use ajax directly, not a helper, if you have this kind of specific needs. It's quite simple with the new signature and deferreds:
Alternativaly, you can use a prefilter if you wanna ensure all script requests are cached:
You could also code your own helper:
As you can see, you have lots of options and alternatives. Changing the helpers signature is to avoid as much as possible, especially when simple alternatives exist. Let's try to avoid the bloat as much as possible.