Error Request Ajax and jQuery versions

0

I have a problem understanding and solving a problem with an Ajax request I need to make. Here is a list of the subject sequence that I will say:

  • Explain what I need;
  • Explain what I want to do;
  • Show how you are currently;
  • Show the solutions I've tried;

First: I am developing a travel website, where this site has a navbar , in this navbar there is a menu called 'Information'. It turns out that I have a platform / system that the user accesses and creates an article that is inserted as a Dropdown menu item every time it creates a new article (the menu has an while ).

What I need and want to do is: every time the visitor clicks one of these Drop Menu items / menus, it opens a Bootstrap modal with the customer's article information. Right?

That's the idea. Well, what I need is to just get this information from the database (which I've already done) and present it on a .php page (which I've already done, call it response.php). This page only displays the text written by the user without any style (done already in the modal or when the article was created). What I have to do is call this page via Javascript with jQuery and Ajax (which is what I want to do). However this is my problem and I'm not sure where I need to see it. See below

Problem Point: 1st: The jQuery version used is 2.1.4 (another dev worked before and got it), and I tried using a more current version. The result was that the request worked only if other plugins that used jQuery stopped working or were not recognized.

2º: There are 2 types of links for the site: 1 is with the domain here (www.domainproprio.com) . When it is so, the request appears normally, however when you access the client's actual site ( www.sitedocliente.com.br ), the request when it is made, it hangs and does not go to Success.

3rd: When I try to use the link manually from the request:

www.sitedocliente.com.br/response?page_id=123

The result is:

  

The requested URL / response was not found on this server.

This is already taking me out of earnest and I have compared it with other uses of my ajax and it is ok.

Below is some information about the JS request:

$("[data-page-id]").click(function(){
let page_id=$(this).attr("data-page-id");
let response=$(".response-content");
response.html("<div class='text-center'><i class='fa fas fa-cog fa-spin fa-5x'></i>");
setTimeout(function(){
    $.ajax({
        url:link+"/response?page_id="+page_id,
        type:'GET',
        success:function(data){
        $(response).html(data);
        }
    });
},200); 
});

And now we also have the HTML as the display of this data-page-id attribute: I put it in a very rudimentary way because I do not have access to the server but I rewrote it to understand:

<ul>
        <?php 
            while($pagina = $paginas->fetch_object()){
                <li>
                    <a href="#" data-toggle="modal" data-target="#modal_response" data-page-id="<?= $pagina->id ?>"></a>
                </li>
            }
        ?>
</ul>

This variable $pagina receives the results of the PAGES table that contains the articles written by the client (article sounds strong, it's more a message in a modal ^^).

In addition, $pagina->id is in data-page-id because this will be the reference of each created LI.

Infos:

link is a javascript variable that is receiving the current site;

This is the code of the response page that presents the article in the modal

<?php
    $_GET = $db->Escapar($_GET);

    if(!isset($_GET['page_id'])) 
        die("ID não encontrado");

    $page_id = $_GET['page_id'];

    $pagina = $db->Executar("SELECT * FROM paginas WHERE adm_id=$adm_id AND id=$page_id");

    if($pagina->num_rows == 0) die("ID não encontrado");
        $pagina = $pagina->fetch_object();

?>

<!--<img style="margin: 0 auto; max-height: 250px; display: block" src="<?=$pagina->avatar?>"/>-->
<br>
<?=$pagina->pagina; ?>

Is this enough information? Tell me what you think and how I can fix it.

Thank you!

EDIT 1: Before you ask me or not haha ... The URI /response?page_id=01 does not have .php because of this cute here:

if($url[0] == "response") {
    include "response.php";
    exit();
}

EDIT 2: Now that I have informed you enough to understand the operation and that in my view is correct, I need to know why the request can not access from the client site, only from my server, everything is the same and loaded there?

    
asked by anonymous 31.07.2018 / 19:31

0 answers