我写了一个ajax请求,我在本地测式是好好的,但是我放在服务器上面执行就不行了。也查不出原因来?你们曾经有这种情况没有。ajax
function showList(id){
url='ajaxlist.php';
$.get(url,{id:id},
function (e){
if(e==0){
$("#info").html("无支付信息");
} else{
$("#info").html(e);
}
});
}<?php
require_once("config.php");
$news= new Db_Base();
mysql_query("set names utf8");
$sql=" SELECT paytype FROM  `nav` WHERE  `id` = ".$_GET['id']." LIMIT 1";
$news->Db_Query($sql);
$row=$news->Db_Fetch_Array();
if($row){
echo json_decode($row['paytype']);
}else{
die(0);
}
?>
服务端:

解决方案 »

  1.   

    首先确认服务器是否支持json. 还有不是应该用 json_encode 吗?
      

  2.   

    url='ajaxlist.php';路径的问题吧。用绝对的试试
      

  3.   

    使用var_dump输出后台数据,firebug等看看后台传递的数据格式对不对,是否bom头、编码等ajax传统问题?
      

  4.   

     $.get(url,{id:id},
        function (e){
            if(e==0){
                $("#info").html("无支付信息");    
            } else{
                $("#info").html(e);    
            }
        });    是不是你的get方式type应该是json传送吧。
      

  5.   

    $.get(url,{id:id}, ???
    $.get(url,{'id':id},
    不知是否手误单独执行服务器端程序,检查返回结果是否正常