Note that there are some explanatory texts on larger screens.

plurals
  1. POAjax in Codeigniter doesn't work for a specific controller in remote host
    text
    copied!<p>My web application does Ajax request to a Codeigniter-php code in a remote server. It works in localhost but not with a specific controller in remote host. It is strange because works in localhost for both controllers. The request:</p> <pre><code>$.ajax({ async:true, type: "POST", dataType: "json", url:"/CI/site/index.php/contact/submitContact", data: "", //data example success:arrived, error:problems }); function arrived(data){ var dataJson = eval(data); } function problems(){ $("#result").text('Problems.'); } </code></pre> <p>I check the arrived with <code>log_message</code>. With the next function works fine:</p> <pre><code> function submitContact(){ log_message('error', 'submitContact. '); //If data are received if($_POST){ log_message('error', 'data. [application/controllers/contact.php]'); } } </code></pre> <p>However, If I change the request to <code>url:"/CI/site/index.php/control/controlHome"</code>, there isn't any log message and the output is the next: <code>POST http://www.page.com/CI/site/index.php/control/controlHome 500 (Internal Server Error)</code></p> <p>The function <code>/application/controllers/control.php</code> is the next: </p> <pre><code> function controlHome(){ log_message('error', 'controlHome. [application/controllers/control.php]'); //If data are received if($_POST){ log_message('error', 'data. [application/controllers/control.php]'); } } </code></pre> <p>Also I've tried with complete url in the ajax code but the result is the same. Any setting is required?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload