If you want this to work, you will have to initiate a call through JavaScript using Ajax.
That's what I'm doing:
First, create a PHP file that does all the work you need, and then ask it to perform a simple set of results. Sort of:
echo 'true';
The key should be simple. If you need more than just outlining each result with a space, pipe, or coma, you can subsequently split it into an array.
Secondly, you need to make a javascript call with ajax. That's what I'm doing:
var result = null; var scriptUrl = "your-php-page.php"; $.ajax({ url: scriptUrl, type: 'get', dataType: 'html', async: false, success: function(data) { result = data; } }); return result;
Then you can do whatever you need with the returned data. You can even send it to another PHP page if you need to.
source share