Hi all,

I'm trying to change some html inside a div with ajax, after the user
change the value of a drop down, but I 'cant make it work, it has been
some time I've last coded with jquery and it seems I'm a bit rusted,
can someone help me please? I've banging my head on this for the some
time now

here's my js:

$(document).ready(function(){
         $("select").change(getData);
         function getData() {
                 var idRep = $("#estados").val();
                alert($('repDesc').html()) // returns null (!!!!)
                $('repDesc').empty()
                alert($('repDesc').html())  // returns null (???)
                $.get("get_representantes.php?idRep="+idRep,  function(data){
                         alert("Data Loaded: " + data); // show the correct data
                         $("repDesc").empty();
                         $("repDesc").append(data);
                         $("repDesc").after( data )
                });
         }
});

and the html is very simple :

<div id="repDesc">
        <p id="repD_region">COSTA RICA</p>
        <p id="repD_name">CALÇADOS BOTTERO LTDA.<br>Charles A. Werb</p>
        <p id="repD_address">R. Armindo Schimidt, 676<br>CEP: 95630-000 -
Perobé - RS<br>Fone<br></p>
</div>

if you want to see it live you can check out
http://www.bottero.net/iphone/rep_br.html

TIA
Marcelo Wolfgang

Reply via email to