0

jQuery always appends 2 GET variables at the end of the url like this:

callback=jQuery172010710813803598285_1362438925287&_=1362438934989

But how do they calculate these numbers? I've found out that the first 10 signs of tha last 2 numbers are the current timestamp, but I cannot figure out what the 3 last numbers stand for. Or how the first part is created. Anyone who knows this?

Thanks!

4

2 に答える 2

0

By using some function which tries to provide as many random and unique numbers it can. Some thing like uniqid()(Link) function.

于 2013-03-08T20:43:47.870 に答える
0

It is created using this:

jsonpCallback: function() {
    var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( ajax_nonce++ ) );
    this[ callback ] = true;
    return callback;
}

first, it tries to use a previously used callback if one exists. If none, then it uses jQuery.expando (which is "jQuery" + ( core_version + Math.random() ).replace( /\D/g, "" ) and + "_" + ( ajax_nonce++ ) where ajax_nonce is $.now() calculated at the time jQuery was initialized. This ensures a unique callback name regardless of how fast you send out the requests.

with this in mind, i can assume you're using jQuery 1.7.2 and need to update, :p

于 2013-03-08T21:01:14.517 に答える