title: php: When to use echo and return
body: <p>I have a webpage which incorporates a query/ajax function so that when a text box is completed, a php file is run which autofills some other inputs in the form.</p>
  
  <p>In the php file I run, initally I was using <code>return</code> to send the appropriate data to the jquery/ajax function. However, this wasn't working. I have since found it only works with <code>echo</code>.</p>
  
  <p>Having read about <code>return</code> and <code>echo</code>, I think it is something to do with query/javascript being a client-side language and therefore the request is coming from the browser which requires <code>echo</code> rather than <code>return</code>.</p>
  
  <p>Is this the case - can anyone explain more helpfully why return wont work, and when I should use each.</p>