Can view the tutorials best in Google Chrome, Mozilla Firefox, Opera, higher version of Internet Explorer

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

By [ Java/J2EE Developer & Web Designer ]
Founder of - Indian, lives in United States. You can contact me at


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.
Most Recent Tutorials
Hibernate Recent Posts
Spring Recent Posts
Struts Recent Posts
Recomandded Links Current & UpComing Tutorials
Tutorials Online :
spring Hibernate struts Json Ajax Log4j Log4j
coreJava Servlets

UpComing :
JSP, Web Services [ In Progress ]
Java4s is optimized for learning java technologies, all the examples in this site are constantly reviewed to avoid errors. While using this site you agree to have read and accepted our terms of use and privacy policy
Especially i have prepared this blog by keeping fresher's in mind, however it will be very useful for real time developers too.

© 2014 Java4s All rights reserved. | strPro4Tut v(2.0) Theme designed by Team Java4s.