0
我有這個功能曾經工作,但顯然決定對我傾倒。有沒有人知道什麼是錯的?.append在調用php文件時不起作用
<?php
require("php/connect.php");
session_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Clasificados</title>
<link rel="stylesheet" href="css/index.css"/>
<link type="text/css" href="css/excite-bike/jquery-ui-1.8.19.custom.css" rel="stylesheet" />
<script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.19.custom.min.js"></script>
<script type="text/javascript">
$(function() {
$.post(
'php/bridge.php',
{
fun:"estados"
},
function(answer){
if(answer){
$('#estafil').append(answer);
}
}
);
});
</script>
</head>
<body>
<div id="left">
<form name="search">
<fieldset>
<label for="searchbar">Introduce terminos de busqueda:</label>
<input type="text" name="searchbar" id="searchbar" class="text ui-widget-content ui-corner-all" />
<label for="estafil">Filtrar por estados:</label>
<select name="estafil" id="estafil" class="text ui-widget-content ui-corner-all" >
</select>
<input type="submit" value="Inciciar busqueda" />
</fieldset>
</form>
</div>
</body>
被調用的PHP是這樣的:
require("connect.php");
session_start();
$fun=$_POST['fun'];
$rol=$_SESSION['rol'];
$id=$_SESSION['id'];
if($fun=="estados"){
$query="SELECT Nombre FROM estados";
$extract=mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_assoc($extract)){
echo $row['Nombre'];
}
}
我嘗試了一切,但我真的無法查明問題!
php,html和javascript在一個文件中? – 2012-04-27 12:28:58
'#estafil'是一個
@ScottM。我相信他們稱之爲*標籤湯* :) http://en.wikipedia.org/wiki/Tag_soup – mattytommo 2012-04-27 12:32:23