1 (edited by desarrollo3 2014-01-10 2:32:01 PM)

Topic: error xajax_core.js:395

My xajax function doesnt and I dont know why?

Put my code:

//HTML $ SMARTY

<div class="seccion texto" id="seccion_texto">
            {include file="noticias-ajax.html"}
</div>

//noticias-ajax.html
<div class="container">
        <div class="row-fluid">
            <div class="span9 noticia">
                {section name=noticia loop=$noticias}
                    <div>
                        <p class="lead">{$noticias[noticia].titulo}</p>
                        <p class="date">{$noticias[noticia].fecha_eu}</p>
                        <img src="{$_WEB_MULTIMEDIA_NOTICIAS}/{$noticias[noticia].id}/{$noticias[noticia].imagen}"/>
                        {$noticias[noticia].descripcion}
                    </div>
                {/section}
            </div>
            <div class="span3 ultimas-noticias">
                <h3>{$txt_aside_noticia}</h3>
                <ul class="unstyled">
                    {section name=ultimas loop=$ultimasNoticias}
                        <li>
                            <a href="/{$ultimasNoticias[ultimas].seo}">{$ultimasNoticias[ultimas].titulo}</a>
                        </li>
                    {/section}
                </ul>
                <hr/>
                <h3>Links</h3>
                <ul class="destacados">
                    {section name="link" loop="$links"}
                        <li>
                            <a href="{$links[link].link}" target="_blank">{$links[link].nombre}</a>
                        </li>
                    {/section}
                </ul>
            </div>
        </div>
        
        {if $rs_paginacion}
            <div class="row-fluid">
                <div class="span9">
                    <div class="pagination pagination-medium text-center">
                        <ul>
                            {if $rs_paginacion.pagina_activa > 0}
                                <li>
                                    <a style="cursor:pointer;" onclick="xajax_setPaginacion({$rs_paginacion.pagina_activa-1});">Ant</a>
                                </li>
                            {/if}
                            {section name=pag loop=$rs_paginacion.paginas}
                                <li>
                                    <a style="cursor:pointer;" onclick="xajax_setPaginacion({$smarty.section.pag.index+1});">{$smarty.section.pag.index+1}</a>
                                </li>
                            {/section}
                            {if $rs_paginacion.pagina_activa neq  $smarty.section.pag.last}
                                <li>
                                    <a style="cursor:pointer;" onclick="xajax_setPaginacion('{$smarty.section.pag.last+1}');">Next</a>
                                </li>
                            {/if}
                        </ul>
                    </div>
                </div>
            </div>
        {/if}
    </div>

// PHP xajax function

function setPaginacion($pagina) {
        include_once('config.php');
        global $smarty;
        
        require_once('noticias.class.php');
        $objN = new noticia();
        $smarty->assign('rs_paginacion',$objN->getNoticiasPaginacion($pagina));
        $smarty->assign('noticias',$objN->getNoticias($tipo,$pagina));
        $smarty->assign('ultimasNoticias',$objN->getUltimaNoticia(5));
        $smarty->assign('links',$objN->getLinks());
        
        $html = $smarty->fetch('noticias-ajax.html');
        $objResponse = new xajaxResponse();
        // To debug but the alert doesnt appear
        $objResponse->script("alert('afasdgsdgdsg')");
        $objResponse->assign('seccion_texto','innerHTML', $html);        
        return $objResponse;
        
    }

Thanks to all.

Re: error xajax_core.js:395

Hello,

Have you activated the xajax debugger? $xajax->configure('debug',true); It provides a lot of information.

If that doesn't help, could you post the entire page - php and html - including the config.php and noticeas.class.php?

Happy to help but I can't tell much from these pieces.

Ed

Ed

If you ever stop learning you may as well dig a hole, crawl in and pull the top over yourself.

Re: error xajax_core.js:395

Thanks for your answer, this is the log error but I dont understand want to say the error.

Mon Jan 13 2014 08:51:16 GMT+0100 (Hora estándar romance)
ERROR: No response processor is available to process the response from the server.
Content-Type: text/html.
Check for error messages from the server.

This is the config.php

include(_XAJAX_DIR.'/xajax_core/xajax.inc.php');
$xajax = new xajax();
$xajax->setFlag('debug',false);
$xajax->setCharEncoding('UTF-8');
$xajax->configure('decodeUTF8Input',true);
$xajax->configure('debug',true);
$xajax->registerFunction("setPaginacion");    
$xajax->processRequest();
$smarty->assign('_XAJAX_JS', $xajax->getJavascript(_XAJAX_WEB));

In the first post I put the all html, and this is the noticias.class.php

class noticia{  
  var $con;
    var $id;
    var $img;
    var $nombre;
  var $nombre_fich_img;
  function noticia() {
    global $con;
    $this->con = $con;
  }
  
  function getUltimaNoticia($limit=""){
    $sql = "SELECT  i.nombre, nd.id_idioma, 
    nd.titulo, n.imagen, n.id, 
    nd.descripcion, n.fecha, DATE_FORMAT(n.fecha, '%d/%m/%Y') as fecha_eu, 
    n.activo, n.orden, n.seo
    FROM  noticias n
    INNER JOIN noticias_detalle nd 
    ON n.id = nd.id_noticia ";
    $sql.= " AND nd.id_idioma = ".$_SESSION['_IDIOMAS_ID'];
    $sql.= " INNER JOIN idioma i ON i.id = nd.id_idioma ";
    $sql.= " WHERE n.activo = 'S' ORDER BY n.fecha DESC LIMIT 0,";
    $sql.= ($limit)?$limit:"1";
    if(!$limit)
        return $this->con->get_rs($sql);
    return $this->con->get_array_asoc($this->con->consultar($sql)); 
  }
  function getNoticias($id ="",$pagina = 0, $orderBy = "", $idioma = "") {
    mysql_query( "SET lc_time_names = 'es_ES'" ); 
        $sql = "SELECT  i.nombre, nd.id_idioma, 
    nd.titulo, n.imagen, n.id, 
    nd.descripcion, n.fecha, DATE_FORMAT(n.fecha, '%M, %Y') as fecha_eu, 
    n.activo, n.orden, n.seo 
    FROM  noticias n
    INNER JOIN noticias_detalle nd 
    ON n.id = nd.id_noticia ";
         
      $sql.= " AND nd.id_idioma = ".$_SESSION['_IDIOMAS_ID'];
    $sql.= " INNER JOIN idioma i ON i.id = nd.id_idioma ";
    if($id!="")
        $sql .= " WHERE n.id=".$id;
    else{                        
        $sql.= " ORDER BY n.id DESC";
        $sql.= " LIMIT ".(_ADMIN_ITEMS_POR_PAGINA * $pagina).", "._ADMIN_ITEMS_POR_PAGINA;
    }
    //echo $sql;
    return $this->con->get_array_asoc($this->con->consultar($sql));
  }
  function getNoticiasPaginacion($pagina = 0, $idioma = "") {
    $sql = "SELECT 1 FROM noticias n 
    INNER JOIN noticias_detalle nd 
    ON n.id = nd.id_noticia ";
          
      $sql.= " AND nd.id_idioma = ".$_SESSION['_IDIOMAS_ID'];
    //echo $sql;
    $rs = $this->con->get_array_asoc($this->con->consultar($sql));
    if($rs) {
      $res['paginas'] = ceil(count($rs) / _ADMIN_ITEMS_POR_PAGINA);
      $res['pagina_activa'] = ($pagina!="")?$pagina:0;
    }
    return $res;
  }

Thanks for all!!