• 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

Ajax Suggest

 
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,

There is an example on w3schools in which Ajax Suggest Code is given.

Following files are used for said example....
1. One HTML file.
2. A Java Script File
3. An ASP file which contains suggestions in an array.

From this asp file they are trying to fetch Suggestions as per key is pressed.

After i followed all the instructions,
problem is that whenever i type any alphabet, whole ASP code is getting attached
with suggestion area.
And i've also tried with PHP file instead of ASP but still, result is same.......

I've tried it on Chrome, IE7 and FireFox....

Please help....

Ref link : http://www.w3schools.com/Ajax/ajax_source.asp
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is your server set up to execute asp or php?

Eric
 
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
(Placeholder message 'cuz I want to see how this one pans out: morbid curiosity.)
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

David Newton wrote:(Placeholder message 'cuz I want to see how this one pans out: morbid curiosity.)



You could always click the watch button. Also UseRealWords because 'cuz is not a word. :)
 
David Newton
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
Meh; watching is too hard. I get too much email as it is. Is "meh" a word yet?
 
Aditya Kanitkar
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Eric Pascarello wrote:Is your server set up to execute asp or php?

Eric



Not actually.

I dont have any server around here. I'm just doing it on my local machine.

But is that the cause for my problem...?? Do i have to setup some server to execute
ASP or PHP....?
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ummm, yes.
 
Aditya Kanitkar
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:Ummm, yes.



Ok. So can you tell me how to do that please?
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can't help you with ASP as I don't use Windows. Enabling PHP in Apache is fairly easy on OS X -- so I imagine it'd be pretty much the same elsewhere.

A google search should give you what you need.
 
David Newton
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
If you're just trying things out you don't necessarily need a back-end language, you can return static data.
 
Aditya Kanitkar
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

David Newton wrote:If you're just trying things out you don't necessarily need a back-end language, you can return static data.



This is the javascript file.....



And this is getHint.asp



So, now i just want to print static data like Mr. David said.....
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can't do that with ASP. If you want to serve ASP, you'll need to set up an ASP server. Plain and simple. No other way around it.

If you want to serve a static file, you'll need to create a text file with the static text that you want returned. No ASP. No PHP. No code of any type. Just text.
 
David Newton
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
(Morbid curiosity satisfied.)
 
Aditya Kanitkar
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:You can't do that with ASP. If you want to serve ASP, you'll need to set up an ASP server. Plain and simple. No other way around it.

If you want to serve a static file, you'll need to create a text file with the static text that you want returned. No ASP. No PHP. No code of any type. Just text.



Now i'm using JSP instead of ASP or PHP and these files are put inside eclipse project.
Now i'm getting what is expected....

But my new question is....

As we are returning the responseText in this Javascript Function....



Is there such rule in AJAX that the responseText will be returned only once...??
I mean if i want to return Multiple results as various responseText....
Can we do that?
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One request == one response.
 
David Newton
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
If you need more data, consider returning JSON (or XML if you must).
 
reply
    Bookmark Topic Watch Topic
  • New Topic