I am hoping someone can help me out and see if they can see why when I
select a dropdown list value it is not auto populating into the input
text values, the response comes back fine with the xml although it is
not update the values in the input form, here is code I am having
problems with below.

JQuery Code
$(document).ready(function() {
    $("#charity_val").change(function(){
        var charity = $("#charity_val").val();

        $.post("ajax.php",{ charity_val: charity },
                function(xml){
            var address = $("address",xml).text();
            alert(address);
            var suburb = $("suburb",xml).text();
            var postcode = $("postcode",xml).text();
            var state = $("state",xml).text();
            var country = $("country",xml).text();

            $("#charity_address").attr("value",address);
            $("#charity_suburb").attr("value",suburb);
            $("#charity_postcode").attr("value",postcode);
            $("#charity_state").attr("value",state);
            $("#charity_country").attr("value",country);

        });
    });
});


php Code
header('Content-Type: text/xml; charset=utf-8');
$value = $_REQUEST['charity_val'];

$query = mysql_query("SELECT * FROM step_7_charities WHERE id_charity
= {$value}");
while($row = mysql_fetch_array($query)) {
        $U['charity_address'] = $row['address'];
        $U['charity_suburb'] = $row['suburb'];
        $U['charity_postcode'] = $row['postcode'];
        $U['charity_state'] = $row['id_state'];
        $U['charity_country'] = $row['country'];
}
$returnXML = "<response><address>".$U['charity_address']."</
address><suburb>".$U['charity_suburb']."</suburb><postcode>".
$U['charity_postcode']."</postcode><state>".$U['charity_state']."</
state><country>".$U['charity_country']."</country></response>";
echo $returnXML;

Thankyou

Reply via email to