Using JQuery AJAX to grab some data from the Database and print them out according to each DIV ID
<p>I was trying to grab some data from the database using JQuery AJAx, and print the data to the DIV with a unique ID.<br/></p>

<p>I got two DIV tags like this:<br/></p>

<pre><code>&lt;div id="1" class="myClass"&gt;
The content for texting1 is : $printing result from the Test Table which id=1
&lt;/div&gt;

&lt;div id="2" class="myClass"&gt;
The content for texting2 is : $printing result from the Test Table which id=2
&lt;/div&gt;
</code></pre>

<p>Here is the function in a Controller:<br/></p>

<pre><code>  function findcontent($id=null){  
            $this-&gt;autoRender=false; 
              $result=$this-&gt;Test-&gt;findByid($id);               
               if($result){
                return $result['content'];
                            }
               else{
                 return "nothing";


  }
    }  

&lt;script type="text/javascript"&gt;
$(document).ready(function(){ 
var id=$("div #myClass").val(); // I am stuck over this line of code
var curl="http://localhost:8080/test/findcontent"+id;

$.ajax({
      type: "POST",
      url: curl,   
      success: function(data) { 
      var w=data.substring(0,1);
          alert(data);
                           });
      });
});
&lt;/script&gt;
</code></pre>

<p>I have no idea how to move on since I there are more than two DIV tags in my case.<br/>
I need your help.</p>
