When using the cookie plugin, the first ajax call isn't fired
See original GitHub issueWhen using the cookie
extension it looks like the overridden _initServer
in the extension returns too early and never tries to call the url here https://github.com/wenzhixin/bootstrap-table/blob/develop/src/extensions/cookie/bootstrap-table-cookie.js#L302-L305 I’m not sure what the logic is doing here, hence no patch 😃
Example: https://jsfiddle.net/spfgx18g/1/
When you load this you see the url is never called. If you comment out the cooke and re-run it will call the URL.
This also presents itself with serverside pagination, the first call is not sent but sorting will then send the ajax call.
May be related to https://github.com/wenzhixin/bootstrap-table/issues/2483 as well
Issue Analytics
- State:
- Created 7 years ago
- Comments:8 (2 by maintainers)
Top Results From Across the Web
Why is jQuery's .ajax() method not sending my session cookie?
I am operating in cross-domain scenario. During login remote server is returning Set-Cookie header along with Access-Control-Allow-Credentials set to true.
Read more >jQuery API Documentation
jQuery API. jQuery is a fast, small, and feature-rich JavaScript library. It makes things like HTML document traversal and manipulation, event handling, ...
Read more >Getting started - Developer guides - MDN Web Docs
This article guides you through the AJAX basics and gives you some simple hands-on examples to get you started.
Read more >PHP setcookie() Function - W3Schools
A cookie is a small file that the server embeds on the user's computer. Each time the same computer requests a page with...
Read more >PHP cookie not set within AJAX call
Apparently I was missing the time() attribute. So when adding this to the expire option in the setCookie function, the cookie is being...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It seems that it is js’s typecast issue. In Cookie.js we have:
If you try in console
false && []
you will get expectedfalse
, but unfortunately if you trytrue && []
you’ll gotArray
instead ofBoolean
, that;s whyreturn;
will be executed even if cookies are not presented.So solution is pretty simple, we need just to change
to
@wenzhixin , Could you update this module.