title: jQuery.ajax how to receive data from another page's div
body: <p>I am new studing jquery.ajax. I still have some question. how to receive data from another page's div? I am tried to do this: open a.php, send html data from div#send to b.php, then return the data from b.php <code>div#aa</code> and show in a.php <code>div#result</code>, from b.php <code>div#bb</code> and show in a.php <code>div#text</code>.  Thanks.</p>
  
  <p>a.php</p>
  
  <pre><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js" type="text/javascript"&gt;&lt;/script&gt; 
  &lt;script language="javascript"&gt; 
  $(document).ready(function () {      
  var params = "value=" + $('#send').text();   
  $.ajax({        
       url:'b.php',        
       type:'post',                 
       dataType:'html',            
       data:params,            
       success:data     
       }); 
  function data (html) {   
  $("#result").html('#aa'); 
  $("#text").html('#bb'); 
  } 
  }); 
  &lt;/script&gt;
  &lt;body&gt;
  &lt;div id="result"&gt;&lt;/div&gt;// I need return 'this is an apple.'
  &lt;div id="text"&gt;&lt;/div&gt;//I need return 'A red apple'.
  &lt;div id="send"&gt;apple&lt;/div&gt;
  </code></pre>
  
  <p>b.php</p>
  
  <pre><code>&lt;?php
  echo '&lt;div id="aa"&gt;';
  echo 'This is an '.$_REQUEST['value'].'.'; 
  echo '&lt;/div&gt;';
  echo '&lt;div id="bb"&gt;';
  echo 'A red '.$_REQUEST['value'].'.'; 
  echo '&lt;/div&gt;';
  ?&gt;
  </code></pre>