I am dynamically generating a select element using javasript and DOM methods. There are a couple of text fields in my form and what I need is that according to the option that user chooses in the select the corresponding fields should get populated from the database. For that I tried setting the select.onChange = somefunction but am not to sure how can I obtain the values from the database. How do I connect to the database in javascript. For sample I will enclose the code
[CODE]<script type=”text/javascript”>
function Change()
{
// How do I fetch the database values from the javascript??
}
function Select()
{
var select1= document.createElement(‘select’);
select1.setAttribute(‘name’,’company’);
select1.setAttribute(‘id’,’azcompany’);
select1.setAttribute(‘size’,’1′);
select1.style.position = ‘absolute’;
select1.style.left = ‘250px’;
select1.style.top = ‘225px’;
select1.style.width = ‘250px’;
select.onChange = javascript/change(); //Please not I am unfamiliar with the synatax but this is what I want to do
Is there some other way that I can do this ?
Thanks in advance