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.
In the php file I run, initally I was using return
to send the appropriate data to the jquery/ajax function. However, this wasn't working. I have since found it only works with echo
.
Having read about return
and echo
, 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 echo
rather than return
.
Is this the case - can anyone explain more helpfully why return wont work, and when I should use each.