title: get json_encode from codeigniter controller to jquery
body: <p>I have a problem in jQuery, on how to get data from my <a href="http://ellislab.com/codeigniter" rel="nofollow">codeigniter</a> controller to jQuery function.</p>
  
  <p>I am having a progress bar in jQuery and i need the value of the progress bar will be depend on the output of the controller; i use <strong><a href="http://www.php.net/manual/en/function.json-encode.php" rel="nofollow">json_encode</a></strong> in controller.</p>
  
  <p><strong>Jquery</strong></p>
  
  <pre><code>$(function() {
    $( "#progressbar" ).progressbar({
    value: //get value from the controller json_encode
        });
    });
  </code></pre>
  
  <p><strong>Controller</strong></p>
  
  <pre><code>public function countScoreCh(){
  $id = $this-&gt;session-&gt;userdata('userID');
  $data['getScore'] = $this-&gt;lawmodel-&gt;battleUserID($id);
  foreach($data['getScore'] as $row){
      $scoreCH = $row-&gt;challengerScore;
      echo json_encode(
      array(
      'scoreCH' =&gt; $scoreCH,
              )
          );
  }
  </code></pre>
  
  <p>}</p>
  
  <p>the progress bar function will be something like this.</p>
  
  <pre><code>$(function() {
    $( "#progressbar" ).progressbar({
    value:   //jsn.scoreCH value
        });
    });
  </code></pre>
  
  <p>Is there's a possible way of doing it? I don't know if using json_encode is the correct way. But any solution will do..:)</p>
  
  <p>Thanks..</p>