douwuying4709 2013-03-25 13:02
浏览 236

AJAX XMLHttpRequest给出错误

I have to deploy an application writhed on php, it was developed using a wamp server (on win). Now I have to deploy it on a apache2 debian server. The application works on the developers PC using wamp but can't get it to work on the debian server.

The problem is that all the grids (jquery grids) loads contents using ajax

grid.jqGrid({
            datatype: "xml",
            url:'../Controladores/cPedidos.php?action=lpd',
            mtype: 'POST',
            colNames:['FECHA','DEPOSITO','USUARIO'],
            colModel:[
                {name:'fecha_pedido',index:'fecha_pedido',width:120, sorttype: 'date'},
                {name:'deposito',index:'deposito',width:500, editable:false},
                {name:'usuario_id',index:'usuario_id',width:150, editable: false}
            ],
            rowNum:10,
            rowList:[10,20,40],
            pager: '#paginacion',
            gridview:true,
            rownumbers:true,
            ignoreCase:true,
            sortname: 'fecha_pedido',
            viewrecords: true,
            sortorder: "asc",
            caption:"Pedidos",
            height: "100%",
            subGrid : true,
            subGridUrl: '../Controladores/cPedidos.php?action=lad',
            subGridModel: [{ name  : ['Codigo','Cantidad','Articulo','Estado','Categoria','Observaciones'], 
                width : [50,50,450,60,60,150] }], 
            editurl: '../Controladores/cPedidos.php?action=editar',
            ondblClickRow: function(id, ri, ci) {
                // edit the row and save it on press "enter" key
                grid.jqGrid('editRow',id,true,null,null, 'clientArray');
            },
            onSelectRow: function(id) {
                if (id && id !== lastSel) {
                    // cancel editing of the previous selected row if it was in editing state.
                    // jqGrid hold intern savedRow array inside of jqGrid object,
                    // so it is safe to call restoreRow method with any id parameter
                    // if jqGrid not in editing state
                    if (typeof lastSel !== "undefined") {
                        grid.jqGrid('restoreRow',lastSel);
                    }
                    lastSel = id;
                }
            }
        }).jqGrid('navGrid','#pager',{add:false,edit:false},{},{},myDelOptions,{multipleSearch:true,overlay:false});
        //grid.jqGrid('filterToolbar',{defaultSearch:'cn',stringResult:true});
        $("#filtro").change(function(){
            var valor = $("#filtro").val();
            $("#tablapedidos").jqGrid().setGridParam({url:'../Controladores/cPedidos.php?action=lpd&filtro='+valor}).trigger('reloadGrid');
        });

The problem is that nothing is loaded, using firebug I get that the post to the url is aborted.

if I enter the url directly on the browser (ff) I get an "The connection was reset" error, Chrome:"Error 324 (net::ERR_EMPTY_RESPONSE)". if I do it on the localhost of the developers pc I get the XML file, the url page create the XML file using echo, example (not complete)

function getArticulosPendientes() {
if ( stristr($_SERVER["HTTP_ACCEPT"],"application/xhtml+xml") ) {
header("Content-type: application/xhtml+xml;charset=utf-8"); } else {
header("Content-type: text/xml;charset=utf-8");
}
$et = ">";
echo "<?xml version='1.0' encoding='utf-8'?$et
";
echo "<rows>";

$lista = getListaArticulosPendientes($_POST);
$resultado = array();

for($i = 0; $i < count($lista); $i++) {
    $fila = $lista[$i];
    $dif = diferenciaCompradoPedido($fila['item_id']);
    if($dif > 0) {
        $fila['cantidad'] = $dif;
        array_push($resultado, $fila);
    }
    else {
        array_push($resultado, $fila);
    }
}

for($a = 0; $a < count($resultado); $a++) {
    $row = $resultado[$a];
    $fecha = date("d/m/Y H:i", strtotime($row["fecha_pedido"]));
    echo "<row id='". $row["item_id"]."'>";
    echo "<cell>". $fecha."</cell>";
    echo "<cell>". $row["cantidad"]."</cell>";
    echo "<cell><![CDATA[". utf8_encode($row["descripcion"])."]]></cell>";
    echo "<cell><![CDATA[". $row["categoria"]."]]></cell>";
    echo "<cell><![CDATA[". $row["usuario_id"]."]]></cell>";
    echo "<cell><![CDATA[". $row["estado"]."]]></cell>";
    echo "<cell><![CDATA[". $row["observaciones"]."]]></cell>";
    echo "</row>";
}
echo "</rows>";

}

any ideas

  • 写回答

1条回答 默认 最新

  • douxi3977 2013-03-25 13:06
    关注

    You are using a relative path. Change path to absolute path like: http://www.yourdomain.com/folder/path/to/Controladores/cPedidos.php?action=lpd

    评论

报告相同问题?

悬赏问题

  • ¥20 模型在y分布之外的数据上预测能力不好如何解决
  • ¥15 processing提取音乐节奏
  • ¥15 gg加速器加速游戏时,提示不是x86架构
  • ¥15 python按要求编写程序
  • ¥15 Python输入字符串转化为列表排序具体见图,严格按照输入
  • ¥20 XP系统在重新启动后进不去桌面,一直黑屏。
  • ¥15 opencv图像处理,需要四个处理结果图
  • ¥15 无线移动边缘计算系统中的系统模型
  • ¥15 深度学习中的画图问题
  • ¥15 java报错:使用mybatis plus查询一个只返回一条数据的sql,却报错返回了1000多条