473,396 Members | 2,020 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,396 software developers and data experts.

ajax code for combo box(list box)

18
hi dere,

i'm new to ajax.. i did a small example using it successfully.. but the problem i'm facing is, how to display the data in a combo box.. if i know the no.of values that is coming from db i can do it, however i don know the no.of records in db..

to be more simple, if i select a country, corr.states of that country should come..
below is the code i used to dispaly if i kno the no.of records in the db

Expand|Select|Wrap|Line Numbers
  1. function ajaxFunction()
  2. {
  3. var xmlHttp;
  4. try
  5.   {  // Firefox, Opera 8.0+, Safari 
  6.   xmlHttp=new XMLHttpRequest();
  7.   }
  8. catch (e)
  9.   {  // Internet Explorer  
  10.   try
  11.     {    
  12.     xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");  
  13.     }
  14.   catch (e)
  15.     {   
  16.     try
  17.       {     
  18.       xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");   
  19.       }
  20.     catch (e)
  21.       {    
  22.       alert("Your browser does not support AJAX!");   
  23.       return false;    
  24.       } 
  25.       } 
  26.       }
  27.   xmlHttp.onreadystatechange=function()
  28.     {
  29.     if(xmlHttp.readyState==4)
  30.       {
  31.       var array;
  32.       array=xmlHttp.responseText.split("|")
  33.       document.form2.contact.value=array[0];
  34.       document.form2.address.value=array[1];
  35.       document.form2.city.value=array[2];
  36.       document.form2.country.value=array[3];
  37.       }
  38.     }
  39.     var user= document.form2.user.value
  40.     var url = "aswajax?user=" + user;
  41.   xmlHttp.open("GET",url,true);
  42.   xmlHttp.send();  }

any help..
thanks in advance..
regards,
aswathn.s
(knowledge is power
Mar 25 '08 #1
1 1668
acoder
16,027 Expert Mod 8TB
Either use XML or JSON, or after splitting, use a for loop to loop over the data. That way you don't need to know the number of records.
Mar 25 '08 #2

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

Similar topics

1
by: bbcdancer | last post by:
Is it possible to restrict the length of a text box in MS Access using VBA on condition to what is selected in a list combo box. Scenario: 1. I have a list combo box containing: AA BBB...
2
by: JweldonH | last post by:
My issue probably has a simple answer. I want to limit a populated combo box to items that are NOT in use in another table. I have a Table with a field that looks up values from another table via...
3
dmjpro
by: dmjpro | last post by:
at first let me clearify .... these (Combo BOX + List BOX) r two different components in html page????? i know how to develope combo box... but list boxxxxxx?????? plz help me .......thanxxx...
4
by: access baby | last post by:
i would like to use combobox or list box in a form for data entry do i have to have a table with value in it and the combobox or list box should look in to that table or i type in the values....
5
FOE2272
by: FOE2272 | last post by:
I have tried every option that I can think of and most of them on this forum. The closest that I got was to bring up the field but it changed the other records based on what was chosen in one...
2
by: Jacko7289 | last post by:
Good Day, My form has two combo boxes where the list of second combo box is dependent on the data chosen from the first combo box. This is how the table (source of data) looks like... Table 1:...
6
by: troy_lee | last post by:
I have a continuous form that has one combo box (cbo1) with the selectable values of "Removal" and "Installation". I would like to change another combo box (cbo2) value list based on the selection...
0
by: Simon | last post by:
Dear reader, In a combo-box there a possibility that by typing the right combination the string in the combo-box will grow to the correct combination in your pick list. So far I know is the...
5
by: Kaosman | last post by:
I have been trying to figure out this problem for a while. All I want to do is have a combo box populate a list box and the list box change to the record based on the users choice. The combo...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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.