dynamically add dropdown menu with ajax

I’m trying to implement a form with a dropdown menu that has element from a database and every time i pick an element from that menu another one appears. I’m trying to do this with ajax but i have no idea how to

i know that i have to use this function to start, but i don’t know how to implement the rest of it

function ajaxRequest() {var request=false;
    try { request = new XMLHttpRequest()}catch(e1){
    try{request = new ActiveXObject("Msxml2.XMLHTTP")}catch(e2){
    try{ request = new ActiveXObject("Microsoft.XMLHTTP")
    }catch(e3){request = false} }
    }
    return request }