Bug Tracker

Modify

Ticket #9275 (closed enhancement: duplicate)

Opened 2 years ago

Last modified 15 months ago

ajax, "no cache" variable name

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

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

Change History

comment:1 Changed 2 years ago by ajpiano

  • Status changed from new to open
  • Component changed from unfiled to ajax

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.

comment:2 Changed 2 years ago by miketaylr

+1

comment:3 Changed 2 years ago by jaubourg

  • Status changed from open to closed
  • Resolution set to duplicate
$.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.

comment:4 Changed 2 years ago by jaubourg

Duplicate of #8305.

comment:5 Changed 2 years ago by ajpiano

jaubourg is right.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.