title: CodeIgniter ajax responseText loading not working
body: <p>I have not understood how Ajax works with CodeIgniter. I explain you the problem.</p>
  
  <p>In the view "Articles" i initially load all the articles. I have a select box too. When i perform an "onChange" i execute a getData() Ajax call with the classic "xmlhttp". The result would be to view only articles which have the needed tipology. "Tipology" is the connector field behind the View (where i see all articles) and the Ajax file.</p>
  
  <p>The error that Firefox console displays me is the following:</p>
  
  <pre><code> GET http://localhost/CodeIgniter/index.php?c=ajax_controller?tipologia=Recensioni 404 Not Found 13ms
  </code></pre>
  
  <p>I don't know if it's the right way to do it, but here i attach you my code, explaining the process:</p>
  
  <p>Main articles view:</p>
  
  <pre><code> &lt;select onChange="getResults()" name="tipologia" id="tipologia"&gt;
        &lt;option&gt;--Seleziona--&lt;/option&gt;
        &lt;option&gt;Recensioni&lt;/option&gt;
        &lt;option&gt;News&lt;/option&gt;
   &lt;/select&gt;
  </code></pre>
  
  <p>In the Main articles view, here is the ajax call</p>
  
  <pre><code> var xmlhttp;
  
   function getResults() {
  
        xmlhttp = new XMLHttpRequest();
  
        var tipologia = document.getElementById("tipologia").value;
        var url = "./index.php?c=ajax_controller?tipologia=" + tipologia;
  
        xmlhttp.onreadystatechange = callback;
  
        xmlhttp.open("GET", url, true);
        xmlhttp.send();
   }
  
   function callback() {
  
        if (xmlhttp.readyState == 4 &amp;&amp; xmlhttp.status == 200) {
             console.log(xmlhttp.responseText);
        }     
   }
  </code></pre>
  
  <p>The response should replace (innerHTML = responseText) the div that actually contains this code (however, the not filtered View and the filtered View should execute the same foreach): </p>
  
  <pre><code>foreach ($contacts as $contact) {
      echo $contact-&gt;id;
      echo " -&gt; ";
      echo $contact-&gt;artist;
      echo " : ";
      echo $contact-&gt;album;
      echo " -&gt; ";
      echo "&lt;a href='/CodeIgniter/index.php?c=new_controller id=".$contact-&gt;id."'&gt;Dettagli&lt;/a&gt;";
      echo "&lt;/br&gt;";
  }
  </code></pre>
  
  <p>This always happens inside the Main article view.</p>
  
  <p>In the model i have this function</p>
  
  <pre><code>function get_ajax_results() {
  
      $tipologia = $_REQUEST['tipologia'];
  
  
      $query = $this-&gt;db-&gt;query("SELECT artist, album, cover FROM contacts WHERE tipologia = '".$tipologia."' ");
      return $query-&gt;result();    
  }
  </code></pre>
  
  <p>In the Ajax controller...</p>
  
  <pre><code>public function index() {
  
      $this-&gt;load-&gt;model("new_model");
  
      $data['contacts'] = $this-&gt;new_model-&gt;get_ajax_results();           
  
      $this-&gt;load-&gt;view('ajax_view', $data);          
  
  }
  </code></pre>
  
  <p>Where is the error? </p>