This season's fashion is to use localStorage for storing data on client's machine. See for example this: php-html.net/tutorials/html5-local-stora....
Very interesting! I'm not too familiar with html5 coding as I'm still a beginner. For instance, what does the interface Storage (....) do?
– andrewliu Oct 18 at 5:33 @andrewliu The interface is just a definition of methods exposed by localStorage and sessionStorage objects. It is taken from the spec dev. W3.Org/html5/webstorage as it is.
– c-smile Oct 18 at 15:56.
It depends. You can cache images, css, js almost everytime because it is always the same. You do not need to do anything, they should cache automatically.
You can also cache GET and POST responses, but that's a bit responsible. You have to know what, when and how often should you flush it. To turn on cache on GET requests by jQuery alone, use $.
Ajax({ 'cache':true, 'url' :'ajax. Php', //and more parameters }).
I'm trying to cache text values from an input field. How would I be able to know what value it is? Is there a way to see that value if I type in an input field?
– andrewliu Oct 18 at 5:24 "you don't need to do anything" except properly configure your web server – Michael Mior Oct 18 at 5:51 @MichaelMior: default (apache2) server gives correct response codes and caches results correctly. – genesis Oct 18 at 11:08 @andrewliu: cache input field? Really, do not think about caching before you're size of Stack Overflow – genesis Oct 18 at 11:09.
A cache is something which sits between a data source (database, hard drive, web resource, etc) and something that needs to access that data source. The idea is that accessing the data from the cache should be faster than accessing the data directly off the data source. If you want to store text field values for use later, (without knowing more about the specifics of your setup), I think you're looking for a cookie.
When the user types text into the textbox, use javascript to set a cookie. The next time the user visits the page, you can retrieve the things they have typed into the text boxes by using javascript to see if the cookie exists and if so, what's in them. Note that this method will cache the data on the user's computer - not on your web server.
If you want to store these values on the web server then you will need to write them to a file or database when the user submits the form, or use AJAX to send the value of the input form to your PHP back-end asynchronously, so it can store the value there. If you can be a little more specific as to what you want to cache/store and why you think you should be doing it, then we can give you a better quality answer with some code examples. Please describe exactly what your problem is, and what you expect the solution to do.
Edit: From your previous question it seems like you want some sort of auto-complete functionality. There are two-types: 1) Auto-complete what the user has previously typed: When the user submits the form, you can do one of 3 things: a) Store the text input in a database. When the user next visits the page, use PHP to embed the previous searches in the javascript (probably as an array).
As the user types in the text-box, use javascript to display the auto-complete box. (Faster for the user, not so practical if you are expecting to store a huge amount of previous inputs per user) b) Store the text input in a database. When the user visits the page, use AJAX to retreive the most likely match as they type.(Slower for the user, but better if you're expecting lots of saved searches per user) c) Store the text input in a cookie.
When the user submits the form, save the input in a cookie. You can either store multiple searches in multiple cookies, or 1 search in 1 delimited cookie. Note that the maximum size for a cookie (including it's name and other details is 4K, so you should keep it's body under 4000 bytes).
NOTE: If configured that way, the browser should automatically auto-complete what the user has previously typed. The only reason you would want to implement this type of auto-complete yourself is if you want some sort of cross-browser or cross-system functionality.2) Predictive auto-complete like when doing a Google search. This method essentially works the same as 1b.
You will have stored in your database a list of previous or suggested search terms. As the user types text into the input field your AJAX request will fetch the most likely candidate for what the user is searching for.
– andrewliu Oct 19 at 2:26 Obviously the more information you're searching through, the longer it will take. You should look into some advanced data structures for storing this information efficiently. At first glance, I think a tree structure would seem to be more suitable for this purpose.
– Ozzah Oct 19 at 4:13.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.