"how to get data from one php page using ajax and pass it to another php page using ajax" Code Answer

4

first of all, you need to echo your data in action.php, and second, use data parameter of ajax request to send data to data.php.

here's the reference:

  • jquery.ajax()

so the organization of pages should be like this:

js :

$.ajax({
    url: "action.php",
    success: function(data){ 
        $.ajax({
            url: "data.php",
            data: {id: data},
            success: function(data){ 
                // your code
                // alert(data);
            }
        });
    }
});

action.php :

<?php
    $test = 1;
    echo $test;
?>

data.php :

<?php
    $id = $_get['id'];
    echo $id;
?>
By Ahosan Karim Asik on March 3 2022

Answers related to “how to get data from one php page using ajax and pass it to another php page using ajax”

Only authorized users can answer the Search term. Please sign in first, or register a free account.