请求到数据,但是没在客户端显示而且一直弹出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;