我已经在不超过 2 小时前就这个问题发表了一篇文章,但我真的需要尽快完成。
我要做的是在苏格兰创建一个由32个不同位置的下拉容器。一个 div WHERE 位置 = 格拉斯哥。
目前我没有每个位置的 URL。
选择新选项时出现以下消息:“加载结果:成功 ||| 200 OK”
有人可以为我提供这个令人沮丧的难题的最后一块吗?
这是我正在使用的文件:
头文件.php
<html>
<head>
<script src="http://code.jquery.com/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('#location').change(function(){
//Retrieve Content from the back-end PHP page, and pass the ID selected
var url = 'location.php?location=' + $(this).val();
$('#txtHint').load(url, function (response, status, xhr) { alert("Load result: " + status + " ||| " + xhr.status + " " + xhr.statusText);
});
});
});
</script>
</head>
<body>
<div id="header">
<div class="headerLeftContent">
<select id="location">
<option value="Glasgow">Glasgow</option>
<option value="x">x</option>
<option value="test">test</option>
<option value="Edinburgh">Edinburgh</option>
</select>
<div id='txtHint'></div>
</div>
</div>
</body>
</html>
位置.php
<?php
$connect = mysql_connect('xxx', 'xxx', 'xxx');
$select_db = mysql_select_db('xxx');
$location = $_REQUEST['location'];
$query = "SELECT * FROM podContent WHERE location = '.$location.'";
$result = mysql_query( $query, $connect );
while($row = mysql_fetch_array($result))
{
echo $row['text'];
}
?>
谢谢。