473,397 Members | 2,028 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Retrieve multiple values using ajax

Hi,

Im new to ajax and im using prototype for a project i am working on. I am hoping to call a servlet written in java which holds a hashtable to strings. When i click on a link it opens up a tab - i want to auto insert the valuse held in the hastable into 7 textboxes. Is there a way to do this? I cannot figure out!!!!

Here is the javascript function i have comp up with so far!


Expand|Select|Wrap|Line Numbers
  1.  function showConfiguration(){
  2.           alert('configuring the server!!');
  3.  
  4.           new Ajax.Request('servlet/Properties', 
  5.                 {                 
  6.                     method:'POST',
  7.                     onSuccess: function(){
  8.                     Hashtable<String,String> properties = Properties.getProperties();
  9.                 document.getElementById("host").value = "test";
  10.                     document.getElementById("channel").value = "test";
  11.                     document.getElementById("queue").value = "test";
  12.                    document.getElementById("port").value = "test";
  13.                    document.getElementById("managerName").value = "test";
  14.                    document.getElementById("username").value = "test";
  15.                    document.getElementById("password").value = "test";
  16.                      },
  17.                      onFailure: function(){ 
  18. alert('Failure');
  19.                     }    
  20.             });
  21.             }
  22.  

The "test" text above should hold the values pulled back from the servlet.

I would really appreciate any help anyone could give me

Thanks
Mar 3 '08 #1
1 2087
acoder
16,027 Expert Mod 8TB
Return the values in a format that can be used in JavaScript, e.g. XML, JSON, HTML or even text separated by a delimiter, e.g. "|". Then parse that with JavaScript.
Mar 5 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: ggk517 | last post by:
We are trying to develop an Engineering application using PHP, Javascript with Informix as the back-end. Is it possible to retrieve data using Javascript but by accessing the Database. Say...
6
by: zoro | last post by:
Hi, I am looking for the recommended way to retrieve several values from a single record, i.e. a typical lookup scenario. An example would be a query that needs to retrieve user_name, user_addres,...
1
by: ykong1214 | last post by:
In my project, there is a single select tag, <html:select property="userName" size="7"> <html:options collection="UserList" property="value" labelProperty="label" /> </html:select> ...
6
by: Daz | last post by:
Hi everyone. Firstly, I apologise if this i not what you would call a PHP problem. I get quite confused as to what lives in which realm, so if this shouldn't be posted here, please suggest where...
4
by: Nathan Sokalski | last post by:
I am a beginner with AJAX, and have managed to learn how to use it when passing single parameters, but I want to return more than one value to the client-side JavaScript function that displays it....
0
by: adelscott | last post by:
Hi, I'm using an autocomplete extender and I would like to retrieve the ID that goes with the label. IE: Label, ID "Mr John","CLIENT0001" "Mr Doe","CLIENT0002" etc..
1
by: bizt | last post by:
Hi, I am having my first real attempt at an ajax class as so far Ive managed to build one that, once instatiated, will allow me to define which function it will call on completion then retrieves...
1
by: divya | last post by:
Hello, I used the below code to move selected items between two listboxes Left and Right:- <%@ Page Language="C#" AutoEventWireup="true" CodeFile="TestPopup.aspx.cs" Inherits="TestPopup" %> ...
1
by: javediq143 | last post by:
Hi All, This is my first post in this forum. I'm developing a CMS for my latest website. This CMS is also in PhP & MySQL. I'm done with the ADD section where the Admin can INSERT new records in...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.