Overview – you click on a button(on a javascript page), that will send a request to a php page to pull up a specific array, then that array should be sent back to the javascript page. When that array is passed into the javascript page, I need to pass it into a function for use. Does anyone know of what to do.
What I am currently doing is below –
<form action="GetTest.php" method="post">
Something: <input id = "something" input type="submit" name="q" on/>
</form>
When i click on submit, I am redirected to my php page which has the array I need(which is expected), but I don’t know what to do from there onwards. Any help on this will be very much appreciated.
First off, handle the HTML so that you aren’t passing it over to the PHP form at all (staying on the page):
Changing:
To:
Then, look into jQuery’s AJAX functionality:
You can retrieve the POST data from GetTest.php and transfer it directly through Javascript as a result.
Good luck!