Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Rinzwind opened this issue Nov 10, 2023 · 2 comments

Comments

@Rinzwind
Copy link

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

@mgol mgol transferred this issue from jquery/jquery Nov 10, 2023
@mgol
Copy link
Member

mgol commented Nov 10, 2023

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.

Rinzwind added a commit to Rinzwind/api.jquery.com that referenced this issue Nov 15, 2023
… to say it works, when set to ‘false’, by appending a counter value rather than a timestamp (see: jquery#1241).
@Rinzwind
Copy link
Author

Sure, I created: #1242

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants