这是为什么?一直200
<script>
$(document).ready(function(){
$("#search").click(function(){
$.ajax({
type:"GET",
url:"getuser.php?username="+$("#keyword").val(),
dataType:"json",
success:function(data){
if(data.success){
$("#searchResult").html(data.msg);
}else{
$("#searchResult").html("出现错误"+data.msg);
}
},
error:function(jqXHR){
alert("发生错误:"+jqXHR.status);
}
});
});
});
</script>
php代码
function search(){
if(!isset($_GET["username"])||empty($_GET["username"])){
echo "参数错误";
return;
}
$da=new user_dal();
$name=$_GET["username"];
$user1=$da->get_a_username($name);
$info=mysql_fetch_array($user1,MYSQL_ASSOC);
$result="用户名:".$info['username']."密码:".$info['password'];
echo $result;