[jQuery] Simple .post won't work
Hello.
Jquery noob, but lovin it.
Can't get a rudimentary post to work, but probably missing something
very simple.
Alerts are working, but div content is never updated.
Following in file called "select.php":
--------------------------------------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://
www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<?php
if(isset($_POST['color'])) {
$color = $_POST['color'];
} else {
$color = 'black';
}
?>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script>
$(document).ready(function(){
$("select").change(function () {
var theValue = this.value;
//alert(theValue);
$.post("select.php", { color: theValue },function(){alert
(theValue);});
});
});
</script>
<style>
div { color:red; }
</style>
</head>
<body>
<select name="select" id="select">
<option value=""></option>
<option value="red">red</option>
<option value="green">green</option>
<option value="blue">blue</option>
</select>
<div>
<?php echo $color; ?>
</div>
</body>
</html>
--------------------------------------------------------------
Thanks for your time...