I have an AJAX request that fetches some info from a SQL database in PHP.
The problem is, I need to send it back to AJAX in variables. Not to just echo it all out on screen.
Is this possible? If so, how would I go about doing something like this?
Thanks.
Yes, you could json_encode the variable you want to send back to client.
The client will receive the data through a callback when the request is completed. Without more clarification on specifics that’s all i can offer, with some more details i can provide code samples depending on whether you’re using a JavaScript library such as jQuery or doing a raw XHR request.
Edit: so in jquery to retrieve the variable above you would do the following.