I have the same problem here, but what I need is to get the value of selected option then save it in a php variable rather than a textbox. I spent almost 2days searching for my gold. Any help will do.thank you.
Edited Here is how I write the code.
<script>
$(document).ready(function () {
$("#country").change(
function () {
var options = {
url: "test.php",
type: "post",
dataType: "json",
data: "country=" + $(this).val(), //build your data string here
success: function (json) {
$("#textbox").val(json.country);
}
};
$.ajax(options);
}
);
});
</script>
<select id="country" name="country">
<option value="Delhi" >India</option>
<option value="manila" >phil</option>
<option value="tokyo" >japan</option>
</select>
<?php
@$d = $_POST['country'];
echo $d;
var_dump($d);
?>