Reputation: 14255
I am using simple javascript to make an ajax call , which works well.But immediately after that if i refresh the page , the call is executed again.Is this a problem of ajax call being cached and how to fix it? I am using php for server side language.
Upvotes: 0
Views: 276
Reputation: 42076
The browser will honor caching rules for ajax requests like any other requests. If you set up proper caching in your php script that serves the response to the ajax call, then browsers should cache it and you won't have a performance hit.
Upvotes: 1
Reputation: 944320
If you refresh a page, then any JavaScript on it will run from scratch. If you do any Ajax in response to the page loading, then it will fire again. If the response to the Ajax request includes cache control HTTP headers, then they should apply.
Upvotes: 0