After trying really hard for the last 10 hours or more, I have not been able to resolve the issue. I hope someone can help me here.
In the javascript code on page1.php, I am making two AJAX calls to page2.php,one after the end of the other.
My first AJAX call on page1.php looks like this:
$.ajax({
type: "POST",
url: "page2.php",
data: { payorder: payOrdNum },
dataType: 'text',
success: function(msg){
callback(msg);
}
})
On success of this AJAX call, I get an array that I pass to a function, callback(msg), as shown below. I retrieve values from the array and make my second AJAX call from inside this function:
function callback(inputmessage) {
...
... code to retrieve array values ...
var pamount = 55.00;
...
//Now my second AJAX call
$.ajax({
type: "POST",
url: "page2.php",
data: {orderamt:pamount} //pamount is one of the array values from the first call
dataType: 'text',
success: function(data){
}
});
}
Here is the problem I am having, When I try to assign the value posted for 'orderamt' in my second AJAX call, to a php variable in page1.php, as below:
<?php
$x_amount = $_POST['orderamt'];
?>
I get the error "Notice: Undefined index" error in my PHP script on page1.php. How can I retrieve the value for 'orderamt' from second AJAX call in the PHP script on page1.php?
Best regards