• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Dynamic Hint using Ajax

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I was following this good Ajax tutorial at W3 and currently practising dynamic suggestion using XMLHTTPRequest (http://www.w3schools.com/ajax/ajax_aspphp.asp)

My problem with it is everytime I key in the text field, onkeyup will trigger server page (gethint.asp/gethint.php). And everytime the server page is triggered, it recreates the name array. Since in the example, it's only 30 names, then it's still fast. But what if there's like 100,000 names? Everytime I key in the text field, it will recreate the whole 100,000 array!!

Is there any better way, like to create name array into memory when the page is loaded first time. And when I key in the text field, it will check in the memory instead of recreate name array again?
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sure, but that'd be on the server side, not the client side. (Or at least it could be.) There are many ways of going about this, depending on the back-end mechanism used to get the data.
 
lucas teh
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yea any idea how to go about it? Kinda blank-minded for now, any hints or guides? Thanks in advance
I tried <body onload="loadInit()"> to request the server page to create array when the client page is loaded.
But that doesn't work because on subsequent requests to the server page, the array is gone.
 
Brace yourself while corporate america tries to sell us its things. Some day they will chill and use tiny ads.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic