title: How to properly pass data with Ajax with CodeIgniter?
body: <p>I want to create a dynamic map with checkbox to customize the marker on the map.
  Of course i use Ajax for that, well i would like to use it :)</p>
  
  <p>My ajax call is ok, i pass the data from the view to the controller with : </p>
  
  <pre><code>$( "input[type=checkbox]" ).click(function() {
    var data = $(this).val();
    var request = $.ajax({
    type: "POST",
    url: "&lt;?php echo site_url(current_url());?&gt;",
    data: "categorie=" + data,
  });
  request.done (function(data){
    var json = data;
    // Remove the markers and add new ones
  </code></pre>
  
  <p>I pass the data to the controller and treat it like this </p>
  
  <pre><code>    if ($this-&gt;input-&gt;is_ajax_request()) {
          $category = $_POST['categorie'];
          $unsigned_url = "http://api.yelp.com/v2/search?location=" . $data-&gt;home['city']['cities_name'] . "&amp;category_filter=" . $category;
          $new_JSON = $this-&gt;listing_lib-&gt;getJsonFromYelp($unsigned_url);
          echo $new_JSON;
      }
  </code></pre>
  
  <p>the problem is, in the json variable in the JS i got the JSON from the PHP but i also get all the DOM of the page?
  Why that ? how can i get only my JSON ?</p>