Here is my Javascript which is below a select box wi开发者_如何转开发th the id of "course_name" and a div with an id of "dates"
<script>
$('#course_name').change(function() {
url = "date_range.php?courseID=".$('#course_name').val();
$("#dates").load(url)
});
</script>
when i call date_range.php?courseID=1 through my browser it displays the dates but the code above is not loading.
url = "date_range.php?courseID="+$('#course_name').val();
or better still,
url = "date_range.php?courseID="+parseInt($('#course_name').val());
the second one will always return a number so it's either 0 (zero) or above, if the #course_name value is a non numeric number it would return zero, otherwise returns the number... this is especially useful when you want to validate the value on the server.
精彩评论