Ajax error when placing on server

Asked

Viewed 140 times

-1

Good afternoon guys, I’m having a hard time, when I’m using my code in my local bank, it works normally... When I play on the server, it gives the following error: Datatables Warning: table id=dt_client - Ajax error. For more information about this error, Please see http://datatables.net/tn/7

inserir a descrição da imagem aqui I already did and I re-did everything, I entered the error link, and I followed the step by step. and gets here inserir a descrição da imagem aqui

Remember that in my local bank it works, and when I open it by the server, it gives this error right away, without any procedure.. What can I do to fix it? I’ll be very grateful if you help me. Some information is already in the comments, but on Leandro’s recommendation, I will post them here.

Useful information that can help: I imported the local bank EXACTLY EQUAL to the server. Before I just tried to SHOW the data, and it appeared normal, after I implemented the function to add/edit the tables it showed the mentioned error.

According to the error, it happens in the list.php which has the following code `

include ("conexion.php");

$query = "SELECT * FROM usuario WHERE estado = 1 ORDER BY idusuario desc;";
$resultado = mysqli_query($conexion, $query);

if( !$resultado ){ 
    die("Error");
}else{ 
    $array["data"] = []; //devuelve un arreglo vacío por si no hay registros en la base de datos.
    while( $data = sqlsrv_fetch_array ($resultado)){ 
        $arreglo["data"][] = array_map("utf8_encode", $data);

    }
    echo json_encode($arreglo);
}

mysqli_free_result($resultado);
mysqli_close($conexion);`

And that’s my "conexion.php"

<?php
$server = "localhost";
$user = "*****";
$password = "****";
$bd = "*****";

$conexion = mysqli_connect($server, $user, $password, $bd);
if (!$conexion){ 
    die('Error de Conexión: ' . mysqli_connect_errno());    
}   
?>

I’m almost sure it’s something on the server, because there are already some code working, what I realized is that they are only "mysql" and what I put now, is "mysqli". I don’t know if it could be something like...

Remembering that in localhost I can add/remove/edit normally, the database works 100%, when I play pro server by winscp, ( same name of the database, files, folders, users, etc) it does not load nor the information.

If necessary, I can pass the entire compressed code, as it has some dependency folders, like js,css etc... ( that also includes on the server). So we can test if it is a REALLY error on the server, or in the code itself. ** Moreover, the server is hosted on a local machine, which is accessed by the IP, I type the ip 177.xxx.xxx.xx / folder when I’m off the network, but my files are hosted on it, so the database is the same localhost.. I don’t know if I was clear or could explain what I wanted...

  • Have you checked the bank’s structure is the same in both environments? Error 500 is not related to Ajax, is a server-side error.

  • Good afternoon Leandro, yes, I imported it from my local bank, and put it exactly on the server... what might be happening, is maybe the User is not as ROOT, or something? ( eu coloquel all previleges nele).. Another thing, when the data was just SHOWN it was working, but when I implemented AJAX at the time of Register/edit things, it gives this error

  • show the code

  • This is the "list.php" code that shows the error.. http://prntscr.com/nk1r74 Another thing I noticed is, in my code I use "mysqli" but in the codes that already work in the bank, it is using only "mysql". But even though I only switch to Mysql it doesn’t work :( I don’t know if this information helps xD And this is the conexion.php http://prntscr.com/nk1tcj

  • I’m pretty sure it’s some configuration on the server (I have no idea how to do it, or fix it).. What I can do, ( also do not know if it is allowed) is to compress all the code, including db, and post here for tests, if it works, I’m sure it is REALLY something on the server, then maybe it will be easier when it comes to solving... I don’t care about the code, just like to solve the difficulty and leave working xD

  • Avoid using images and include the information in your question, not in the comments. I, for example, can’t even see the two prints by blocking in the company.

  • opa, I’m sorry Leandro, I will edit the question including the data, and post the direct code, not his print. Just a minute

  • I haven’t been able to solve it yet... Does anyone have a hint that I can follow/try? Or any other way to search for the bug please

  • Without seeing the stack of error 500 can not help

  • Sorry to ask, but how can I see the stack of error 500? I saw that on a host, we can access the site etc, but if it is local how can I do?

  • What appears if you make the direct request, without ajax, which incidentally, you have not presented so far

Show 6 more comments

1 answer

0

As I imagined, the problem was the server that did not run my codes for some reason, I made an internal server, I made it public and it worked, ( I don’t know how to close the topic xD)

Solved

Browser other questions tagged

You are not signed in. Login or sign up in order to post.