title: Ajax in codeigniter for changing only div in view
body: <blockquote>
    <p>Hello, I want to be able to change only part of the div in my view i
    have tried to write the codes but they are not working perfectly. how
    it works is when i click the button it suppose to sent the value to a
    js then using js to sent data to the controller.</p>
  </blockquote>
  
  <p><strong>SCRIPT:</strong></p>
  
  <pre><code>  function getValue(datas){
       alert(datas) ;
       var mydiv = datas;
       $.Ajax({
            type:"post",
            url:&lt;?php echo base_url('/mama/load_view/');?&gt;
            data:{"mydiv":mydiv},
  
           success:function(data){
               $('#mang_server').html(data);
           }
       });
   }
  </code></pre>
  
  <p><strong>PHP:</strong></p>
  
  <pre><code>  foreach($student_prof as $row){
        $gen = "GeneralInformation";
        echo '&lt;input type="submit"  value="GeneralInformation" class="btn btn-primary active" name="general" id="submit" onclick="getValue("'.$gen.'")"&gt;';
        echo '&lt;/div&gt;';
  
   }
  </code></pre>
  
  <blockquote>
    <p>The Controller code </p>
  </blockquote>
  
  <pre><code>public function load_view(){
  
      $data1 = $this-&gt;input-&gt;post('mydiv');
  
      if($data1 == "GeneralInformation"){
  
          $this-&gt;load-&gt;view('student/profile_view');
      }
      else {
          $this-&gt;load-&gt;view('student/profile_view');
      }
  
  
  }
  </code></pre>