Skip to main content

Bug Tracker

Side navigation

#9275 closed enhancement (duplicate)

Opened May 13, 2011 05:16PM UTC

Closed May 14, 2011 07:53PM UTC

Last modified March 14, 2012 06:18AM UTC

ajax, "no cache" variable name

Reported by: mario.cardia@gmail.com Owned by:
Priority: undecided Milestone: 1.next
Component: ajax Version: 1.6.1
Keywords: Cc:
Blocked by: Blocking:
Description

Sugestion:

Oracle mod_plsql does not accept a variable named as "_".

This causes erros when trying to use jquery ajax with oracle.

To fix this i changed the jquery code replacing "_" with "no_cache". But its no cool because I can´t use the minified version and to update I always have to remember this change.

if ( s.cache === false ) {
    ...
    //s.url = ret + ( (ret === s.url ) ? ( rquery.test( s.url ) ? "&" : "?" ) + "_=" + ts : "" ); // o Cardia
    s.url = ret + ( (ret === s.url ) ? ( rquery.test( s.url ) ? "&" : "?" ) + "no_cache=" + ts : "" ); // n Cardia
    ...
}

I think its very simple to make this variable name be set up with

.ajaxSetup. Can you do that to to future versions? Like:

$.ajaxSetup({
    NO_CACHE_VARIABLE_NAME: "no_cache"
});
...
s.url = ret + ( (ret === s.url ) ? ( rquery.test( s.url ) ? "&" : "?" ) + NO_CACHE_VARIABLE_NAME + "=" + ts : "" );
...

Thanks

Attachments (0)
Change History (5)

Changed May 13, 2011 05:30PM UTC by ajpiano comment:1

component: unfiledajax
status: newopen

I don't think this is an unreasonable request, perhaps we can land it in 1.7! Can you add it to the list of 1.7 proposals in this spreadsheet? Thanks for your time.

Changed May 14, 2011 12:39PM UTC by miketaylr comment:2

+1

Changed May 14, 2011 07:53PM UTC by jaubourg comment:3

resolution: → duplicate
status: openclosed
$.ajaxPrefilter(function( options ) {
    if ( !options.cache && options.noCacheParameter ) {
        options.url += ( /\\?/.test( options.url ) ? "&" : "?" ) +
            options.noCacheParameter + "=" + jQuery.now();
        options.cache = true;
    }
});

$.ajaxSetup({
    noCacheParameter: "no_cache"
});

This kind of environment specific needs is exactly why prefilters have been introduced in the first place.

This has been discussed before and a similar solution was proposed by jitter then.

We have to stop adding options in ajax for very specific use cases (especially now that we have extension points for ajax that makes said options unnecessary in core). We'll have to deal with xhr2 stuff soon enough where new options will be introduced and code size will yet again grow, let's avoid other sources of bloat.

Changed May 14, 2011 07:53PM UTC by jaubourg comment:4

Duplicate of #8305.

Changed May 14, 2011 08:02PM UTC by ajpiano comment:5

jaubourg is right.