title: JQuery Ajax Error {"readyState":0,"responseText":"","status":0,"statusText":"OK"}
body: <p>I try to get the cities according to the country which is passed as parameter and sent via ajax. But for some countries I can get  cities and update my form with these cities, for against for other I have this error</p>
  
  <p><code>{"readyState":0,"responseText":"","status":0,"statusText":"OK"}</code></p>
  
  <p>When I look in logs for those countries that returns me an error I have the names of the cities retrieved from the database.</p>
  
  <p>I do not understand why this error.
   how can I fix it?</p>
  
  <p>Please find below my code</p>
  
  <p><strong>Model</strong></p>
  
  <pre><code> function get_ville_depart($country = null){
          $this-&gt;db-&gt;select('NUMVILLEDEPART, NOMVILLEDEPART')-&gt;from('villedepart');
          $this-&gt;db-&gt;join('pays','pays.NUMPAYS=villedepart.numpays');
          $this-&gt;db-&gt;where('pays.NUMPAYS', $country);
          $this-&gt;db-&gt;order_by("NOMVILLEDEPART","asc");
          $query = $this-&gt;db-&gt;get();
          $cities = array();
  
          if($query-&gt;result()){
              foreach ($query-&gt;result() as $city) {
                  $cities[$city-&gt;NUMVILLEDEPART] = $city-&gt;NOMVILLEDEPART;
              }
              return $cities;
          }else{
              return FALSE;
          }
      }
  </code></pre>
  
  <p><strong>Controller</strong></p>
  
  <pre><code> function get_ville_depart($country){
          foreach($this-&gt;ville_model-&gt;get_ville_depart($country) as $ville){
              log_message('debug',json_encode($ville));
          }
          header('Content-Type: application/json; charset=utf-8');
          echo json_encode($this-&gt;ville_model-&gt;get_ville_depart($country));
      }
  </code></pre>
  
  <p><strong>View</strong></p>
  
  <pre><code>$('#paysdepart').on("change",function(){
                  $("#villedepart &gt; option").remove();
                  var country_id = $('#paysdepart').val();
                  var base_url="&lt;?= site_url('annonce');?&gt;";
                  $.ajax({
                      type: "GET",
                      url: base_url+"/get_ville_depart/"+country_id,
                      dataType:'json',
                      success: function(cities)
                      {
                          if(!jQuery.isEmptyObject(cities))
                          {
                              $("#ifnotvilledepartindatabase").hide();
                              $("#dynamicvilledepart").show();
                              $.each(cities,function(NUMVILLEDEPART,NOMVILLEDEPART)
                              {
                                  var opt = $('&lt;option /&gt;');
                                  opt.val(NUMVILLEDEPART);
                                  opt.text(NOMVILLEDEPART);
                                  $('#villedepart').append(opt);
                              });
                          }else
                          {
                              $("#dynamicvilledepart").hide();
                              $("#ifnotvilledepartindatabase").show()
                          }
                      },
                      error:function(error)
                      {
                          alert("Error "+JSON.stringify(error));
                          $("#dynamicvilledepart").hide();
                          $("#ifnotvilledepartindatabase").show()
                      }
                  });
              });
  </code></pre>