jquery / jquery/api.jquery.com

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

Open Beginner friendly
#1,241 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
HTML
Stars
325
Forks
260
PR merge metrics
No merged PRs in 30d

Description

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}".

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the documentation entry for the ajax cache parameter and compare its wording with the referenced dist/jquery.js lines 9435 and 8501. Update the description so it refers to the appended value as a uid rather than a timestamp; the misleading wording should no longer appear.

Written by the indexing model from the issue text.

Assessment

Tech stack
jquery
Domain
documentation
Issue type
Documentation
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
62/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.