کمکم کننین ajax

سلام
من ابن کد ها رو نوشتم ولی کار نمیکنه کسی اشکال این رو میدونه
PHP:
<?php

print "<pre>".print_r($_POST,1)."</pre>";
    $states=array();
    $states["Australia"] =array("New South Wales" , "Queensland");
    $states["USA"]=array("yazd","tehtan","oronmwwb");
    if(isset($_POST["country"]) && isset($states[$_POST["country"]])){
        foreach($states[$_POST["country"]] as $state){
        printf("%s," , $state);
        } 
    }
?>
و بعد به این وصل کردم
HTML:
<html>
<head>
<script>
    var url = "country.php";
    var what = "SetStates(req.responseText)";
    function GetStates(Country){
        DoCallback("country=" + Country);
    }
    function  SetStates(States){
         
        var statebox = document.getElementById("state");
        statebox.options.length = 0;
        if (States != ""){
            var arrStates = States.split(",");
            for(i = 0; i < arrStates.length; i++){
                if(arrStates[i] !=""){
                    statebox.options[statebox.options.length] = new option(arrStates[i], arrStates[i]);
                }
            }
        }
    }
</script>
<script src="ajax.js" type="text/javascript"></script>
</head>
<body>
    <pre>Country:
    <select onChange="GetStates(this.options[this.selectedIndex].text)" id="country">
        <option value="" ></option>
        <option>Australia</option>
        <option>USA</option>
        </select><br>state:<select id="state">
        </select>
        </pre>
</body>
</html>
ممنون
 

جدیدترین ارسال ها

بالا