I have three php files.
filter.php - to send Ajax request and get response insert.php - to store Ajax response getResponse.php - to use stored Ajax response.
The main goal of all this is to use client-side values ββusing PHP code, because the server and the client cannot exchange variable values ββwith each other.
Expected: the response should be stored in the php variable in getResponse.php.
I got an array response in insert.php, but how can I use in getResponse.php?
For instance,
---------- filter.php ----------
<script> $.ajax({ type: "POST", url: "filter.php", data: { name: tp, country:"test"}, success:function(response) { var res = response; $.ajax({ type: "POST", url: "insert.php", data: { res: res }, success:function(data){ alert(data); } }); }); <script>
-------- insert.php ----------
if ($_POST) { if ($_POST['id1'] !== "") { echo $_POST['id1']; } }
-------- getResponse.php ----------
Code to get array response from Ajax through filter.php and insert.php?
You must save this array value and manipulate accordingly.
Thanks for your help in advance!
source share