Ajax,jQuery Auto Fill Dropdown On Page Load

Ajax » On Oct 25, 2011 By Sivateja

Let us see the auto fill drop downs using Ajax and jQuery

Files Required

  • index.html
  • db_fetch.jsp
  • jquery-1.2.6.js (Add this jquery file at db_fetch.jsp location, same  folder)
  • web.xml


Notes: See line number 6 in index.html ,$(document).ready(function() means we no need to send any request like onchange or onclick, once the page loads automatically the code in this $(document).ready(function() block will be executed, so indirectly we are calling this function on page load hope you are clear.




Note: you must have classes12.jar, ojdbc14.jar in the lib folder of you application


Check Output

Click here to check the output

Java/J2EE Developer & Web Designer, founder of Java4s.com. Sign-up for the email newsletter for your daily dose of Java tutorials.
Email: sivateja@java4s.com


2 Responses to “Ajax,jQuery Auto Fill Dropdown On Page Load”
  1. mahendra says:

    ” document.createElement(“OPTION”);” here you didn’t mention any element id then how could it create option element for second drop down list.

    Thanks & Regards

  2. prasad says:

    here element is created dynamically.
    so, to create element dynamically there is no need of element id.
    it was created by using tagname “option”.
    to create button dynamically we use

    then button created dynamically.

    from: Prasad.k


By posting your answer, you agree to our comments policy.
© 2010 - 2016
Java4s - Get It Yourself.
The content & design is copyrighted to Sivateja Kandula, it may not be reproduced on other websites.
What would you like to learn today?
Browse these popular technologies
Hibernate spring struts Servlets ajax Log4j jQuery Json Core Java Web Services AngularJs

Most Recent Tutorials
Hibernate Recent Posts
Spring Recent Posts
Struts Recent Posts
Recomandded Links
Current & UpComing Tutorials
  Web Services [ SOAP ], JSP
Facebook_Java4s  Twitter_Java4s  GooglePlus_Java4s  Youtube_Java4s 
Contact | About Us | Privacy Policy | Advertise With Us

© 2010 - 2016 Java4s - Get It Yourself.
The content is copyrighted to Sivateja Kandula and may not be reproduced on other websites.