Ajax calls see data the same way that we do, it reads it as a string. It's basically accessing another web page and "receiving" the result. PHP's 'return' is returning the value on the server only. You need to actually output the data so that when the Ajax call is made, the page it is looking at actually has data written out.