Home Async request Ajax+php working on local machine but not in remote server
Reply: 0

Async request Ajax+php working on local machine but not in remote server

Quique Published in 2018-01-12 20:56:39Z

As title says, my application works perfectly on my machine using xampp, but I am having a lot of problems to trespass it to a remote server.

This is my ajax request. It used to throw a "parsererror" when I had the dataType: 'json' in the request, so I changed it to expecting "text", that was the moment I realized that mi php service was returning nothing.

        type: "POST",
        url: 'Controller/ControllerUsuario.php',
        data: { peticion: "cargarEquipos" },
        dataType: 'text',
        success: function(data) {
            alert(data); //here im trying to find the problem
            //What it does here is not important
        error: function(textStatus, errorThrown) {
            console.log("Text Status: " + textStatus +
                        "\nError Thrown: " + errorThrown);

And this is my php code I tried to skip the irrelevant parts becouse is is quite big


 include_once '../DAO/DaoUsuario.php';

 $daoUsuario = new DaoUsuario();
 $Connection = new MysqlConnection();


       if(($_POST["peticion"] == "cargarEquipos"))
          //Do something
          //return data

       //there are more ifs like the last one...

The thing is it doesnt reach the "Do something" section. I put this at the end of the file trying to receive the $_POST array

foreach ($_POST as $key => $value) {
echo '<p>'.$key.'</p>';
foreach($value as $k => $v)
echo '<p>'.$k.'</p>';
echo '<p>'.$v.'</p>';
echo '<hr />';

the response of that is, and is showed in the alert of "success"

<p> peticion </p>

As I said it works on my local computer, I have no idea what is happening.If someone have a suggestion I would like the read it, please.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.311118 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO