api.jquery.com icon indicating copy to clipboard operation
api.jquery.com copied to clipboard

Mention of ‘timestamp’ in documentation for ‘cache’ parameter of ‘ajax’ is misleading

Open Rinzwind opened this issue 2 years ago • 2 comments

The documentation for the ‘cache’ parameter of ‘ajax’ says:

It works by appending "_={timestamp}" to the GET parameters.

This seems a bit misleading. I interpreted it as a timestamp of when the request is sent. But the value after _= is actually taken from a counter:

https://github.com/jquery/jquery/blob/f79d5f1a337528940ab7029d4f8bbba72326f269/dist/jquery.js#L9435

The counter is only initialized using Date.now():

https://github.com/jquery/jquery/blob/f79d5f1a337528940ab7029d4f8bbba72326f269/dist/jquery.js#L8501

I got confused by that when analyzing nginx access logs and wondering why the ‘timestamps’ didn’t match up.

The documentation should probably just say that it works by appending "_={uid}".

Rinzwind avatar Nov 10 '23 13:11 Rinzwind

Thanks for the report. I transferred it to the API repo since it's a docs issue.

Would you like to submit a PR?

BTW, there are a few more similar entries to potentially replace on that same page.

mgol avatar Nov 10 '23 13:11 mgol

Sure, I created: https://github.com/jquery/api.jquery.com/pull/1242

Rinzwind avatar Nov 15 '23 21:11 Rinzwind