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

dynamic value of dropdown in ajax

hai,


I have a dropdown which has dynamic values.When I select a particular value in the dropdown,i want to diaplay
corresponding details .

I donot know how to get the dynamic value from the dropdown using ajax and how to display the details.

give suggestions to do it.
Aug 19 '10 #1
1 1565
RamananKalirajan
608 512MB
Hi, You can do it easily.
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3. <script type="text/javascript">
  4.   function doThis()
  5.    {
  6.  
  7.     var x = document.getElementById('myText').value;
  8.      if(x==""||x==null||x==false)
  9.          {
  10.               alert("Please Enter the Value in the Text Field");
  11.               document.getElementById('myText').focus;     
  12.          } 
  13.          else
  14.          {
  15.             if(window.ActiveXObject)
  16.                 document.getElementById('mySelect').add(new Option(x,x));    
  17.             else
  18.                 document.getElementById('mySelect').add(new Option(x,x),null);    
  19.         }  
  20.    }
  21. </script>
  22. </head>
  23. <body>
  24. Enter Text: <input type="text" id="myText" name="myText">
  25. &nbsp;&nbsp;&nbsp;
  26. <input type="button" value="Add to Combo" onclick="doThis()">
  27. <br/><br/>
  28. <select id="mySelect" name="mySelect" onchange="alert(this.options[this.selectedIndex].value);">
  29.  <option>Select</select>
  30. </select>
  31. </body>
  32. </html>
This is a sample code for dynamically adding values in select box. In the select I have used onchange listener. In that you can fetch the value like that. With that value make your own Ajax call.

Thanks and Regards
Ramanan Kalirajan
Aug 19 '10 #2

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

Similar topics

1
by: D Mineer | last post by:
HEre is my code function passVal(p,q,r){ with (window.opener.form1) { bldr_cmpny.value=p bldr_cotel.value=q; bldr_lcse.value=r; } window.close(); }
2
by: moid | last post by:
how to pass dynamic value to property in usercontrol im using this but its not working <uc1:BusinessUnit id="BusinessUnit1" Type='<%# type %>' POID='<%# poid %>'...
0
by: martin1 | last post by:
Hi, All, In the aspx page sqlDataSource section, I try to use dynamic value in selectCommand where condition, anyone knows how? or correct foramt to use the dcnid value Dim dcnid=12 ...
1
by: mandakini | last post by:
Hello freinds I am working on this url http://72.36.156.243/compbuild.php Here I am using ifram and displaying dynamic value I don't know how to use iframe as array how to assign array and...
0
by: cindy | last post by:
I have a dynamic datagrid. I have custom classes for the controls public class CreateEditItemTemplateDDL : ITemplate { DataTable dtBind; string strddlName; string strSelectedID; string...
3
by: Mukesh | last post by:
sir, i am developing a database, which will store the users profile both personal and professional which includes the address, telephone, gender and etc. in my main table i have created a column...
3
by: farukcse | last post by:
Hi, Can any one tell me how to assign a php variable value using ajax / javascript? Regards, Faruk Chowdhury
5
by: viki1967 | last post by:
Hi all. I need one example for dynamic box whit Ajax and ASP. Can you help me ? Thanks Viki
5
by: temijojo | last post by:
Hello, Can someone help me in this problem. In my content page, I used 2 user controls inside an Ajax Toolkit TabControl. One of the user controls is a data entry with a dropdownlist. The...
4
by: mainul05 | last post by:
hi, i m newbie php+mysql. in i have the following problem. i tried my best to solve it but could do it. please help me. i have a from where 3 fields are STATE, AREA and SUBRUB. AREA is connected...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...

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.