Normally when we use post method with forms, the requests are geting cached. I mean when we use the back button to visit the previous page the request is not being sent to the server to display the previous form. It just loads the form from the cache and loads the field values from the cache. But it is not the case with ajax. when we use ajax with post method the requests are not cached. when we use the back button also the ajax gets the content from the server which is contrary to its "get" method. So why this difference?

Recommended Answers

All 2 Replies

Without a working model and an actual step by step view of what you are doing, this is hard to figure out what exactly is going on.

If you are saying that you fill out a form that posts to a new page, then after the post you hit the back button and the form is all filled out still, then.. woot! That's kinda what is expected. That's not so much a server cache as much as the browser knowing what values were there and putting them back.

If you do an ajax call to a new page and get a result, then hit a back button, you are not in any way dealing with the ajax call, you are dealing with the http request for the page you are on (or the page you previously came from).

Like I said.. it's difficult to understand your problem without seeing it... but that's my best explanation. It's normal behavior, not server caching...

As for your question about GET method (and POST, PUT, DELETE, etc...) not a whole lot of people actively enforce these methods (in fact, the only company that I deal with that actively enforces these at all is LinkedIn). A get is a request with a param stack just like a post, just the post has some perks over a get and vice versa.

I hope that helps..

Ryan

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.