开发者

Reusing ajax results in asp.net mvc

开发者 https://www.devze.com 2023-01-15 22:24 出处:网络
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

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.

  1. initialize cache as empty
  2. search
  3. 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.
  4. goto step 2.
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号