title: data from database and show it in div using ajax codeigniter
body: <p>I have anchor tag, if i click anchor tag i want to show number with that id in one div in that page from database.</p>
  
  <p>my view</p>
  
  <pre><code>&lt;div class="col-sm-4 text-center"&gt;
      &lt;a href="" onClick="return getVotes(userRef);" &gt;&lt;i class="fa fa-phone margin-right-10"&gt;&lt;/i&gt; Call Doctor&lt;/a&gt;
  &lt;/div&gt;
  &lt;div id="content"&gt;&lt;/div&gt;
  
  &lt;script&gt;
  $(document).ready(function(){
      alert("gfdfg");
      function getVotes(userRef){
          $.ajax({
              type: 'get',
              url: 'http://localhost/web/view-number',
              data: 'userRef=' + userRef,
              success: function(data) {
                  //alert(data);
                  $('#content').html(data);
  
              }
          });
      }
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>controller:</p>
  
  <pre><code>          function viewNumber($userRef = NULL){
      //echo "fdsfd";exit;
  
          $this-&gt;load-&gt;model('DoctorSearch');
          $result = $this-&gt;DoctorSearch-&gt;getNumber($userRef);
  
          if ($result) {
              $data['records'] = $result;
          //echo '&lt;pre&gt;'; print_r($data['records']); die('test');
          }
          $this-&gt;load-&gt;view('pages/view-number', $data);
  }
  </code></pre>
  
  <p>model:</p>
  
  <pre><code>      public function getNumber($userRef = NULL) {
      //print_r($userRef); die('test');
      $this-&gt;db-&gt;select('us.userRef,us.medicalRegNo');
      $this-&gt;db-&gt;from('tab_usersprofile as us');
      $this-&gt;db-&gt;where('us.userRef', '3mrTIaKjHAZ2BC7b');
      $query = $this-&gt;db-&gt;get(); 
      //echo $this-&gt;db-&gt;last_query(); die('test');
      $result = $query-&gt;result();
      return $result;     
  }
  </code></pre>
  
  <p>How to do, nothing is calling check my code and give the proper inout</p>