title: Codeigniter - refresing multiple elements with multiple contents using JQuery ajax?
body: <p>what I want to achieve is that multiple divs in my view get fill up with different content using ajax at the same time when a button is clicked, let's say something like this:</p>
  
  <p>view:</p>
  
  <pre><code>&lt;div id="one"&gt;
  &lt;/div&gt;
  
  &lt;div id="two"&gt;
  &lt;/div&gt;
  
  &lt;div id="three"&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>div one, two and three should be refreshed with different content each one.</p>
  
  <p>my script is:</p>
  
  <pre><code>$("input[type='button']").click(function(){
          var mail= $("#mail").val();
          var password = $("#password").val();
  
          $.ajax({
                url: '&lt;?php echo base_url()?&gt;index.php/login/theLogin',
                type: 'POST',
                data: {'mail':mail, 'password':password},
                success: function(data) {
                  $('div#one').html(data);
                  $('div#two').html(data);
                  $('div#three').html(data);
              }
            });
        });
  </code></pre>
  
  <p>controller:</p>
  
  <pre><code>public function theLogin()
  {
  
    $this-&gt;load-&gt;view("ajax/newContent");
  }
  </code></pre>
  
  <p>newContent.php:</p>
  
  <pre><code>&lt;div id="ajax-one"&gt;
  one
  &lt;/div&gt;
  
  &lt;div id="ajax-two"&gt;
  two
  &lt;/div&gt;
  
  &lt;div id="ajax-three"&gt;
  three
  &lt;/div&gt;
  </code></pre>
  
  <p>and the result is obviously the three divs in my view get refreshed with three divs (9 divs in total), but I don't want that, I want that div one gets refreshed only with the content of div ajax-one and so on.</p>
  
  <p>I used something like this in my ajax method but no success:</p>
  
  <pre><code>    success: function(data) {
  
                      $('#one').html($('#ajax-one' , data).html());
                      $('#two').html($('#ajax-two' , data).html());
                      $('#three').html($('#ajax-three' , data).html());
  
                  }
  </code></pre>
  
  <p>What possible solution could exists to solve this? thanks.</p>