Reusing ajax results in asp.net mvc
I want to implement 开发者_Python百科ajax functionality like Google has done here. This is a transliteration application where user types word in Roman and after he/she presses space it sends an ajax call to server bringing back list of probable output words in native script of the language (Urdu in my case).
When writing text when I write a word twice (or more) for Google does not send ajax request but reuses the result of previous ajax call somehow. For example I write word "mera" and press space, Google will send an ajax request and bring back result from the server.
But if I write "mera" again even after 3 or four sentences, Google does not send ajax request and uses the previous result instead. I intend to implement similar functionality using asp.net mvc2. Would someone suggest how I can do this?
You need to create a cache in JavaScript that will store the results of whatever search you have.
- initialize cache as empty
- search
- check to see search item in cache. if item not in cache then retrieve list from server. store list in cache. goto step 3. if item in cache do processing.
- goto step 2.
精彩评论