Передать значение JSON из PHP в Angular через URL

У меня проблемы с отправкой объекта JSON обратно в приложение Angular из сценария PHP. Я пытался сделать это по URL, но я не могу отправить JSON:

header("Location: http://localhost:8000/index.html#/AnotherPage/abcd");

Вот мой код PHP

<?php
header("Pragma: no-cache");
header("Cache-Control: no-cache");
header("Expires: 0");

// following files need to be included
require_once("./lib/config_paytm.php");
require_once("./lib/encdec_paytm.php");

$paytmChecksum = "";
$parameterList1;
$paramList = array();
$isValidChecksum = "FALSE";

$parameterList1 = $_POST;
$paramList = $_POST;

$paytmChecksum = isset($_POST["CHECKSUMHASH"]) ? $_POST["CHECKSUMHASH"] : ""; //Sent by Paytm pg

//Verify all parameters received from Paytm pg to your application. Like MID received from paytm pg is same as your application’s MID, TXN_AMOUNT and ORDER_ID are same as what was sent by you to Paytm PG for initiating transaction etc.
$isValidChecksum = verifychecksum_e($paramList, PAYTM_MERCHANT_KEY, $paytmChecksum); //will return TRUE or FALSE string.


if($isValidChecksum == "TRUE") {
echo "<b>Checksum matched and following are the transaction details:</b>" . "<br/>";
if ($_POST["STATUS"] == "TXN_SUCCESS") {
echo "<b>Transaction status is success</b>" . "<br/>";
print_r($paramList);
echo $paramList;
//Process your transaction here as success transaction.
//Verify amount & order id received from Payment gateway with your application's order id and amount.
}
else {
echo "<b>Transaction status is failure</b>" . "<br/>";
}

if (isset($_POST) && count($_POST)>0 )
{
foreach($_POST as $paramName => $paramValue) {
echo "<br/>" . $paramName . " = " . $paramValue;
}
print_r($paramList);
}


}
else {
echo "<b>Checksum mismatched.</b>";
//Process transaction as suspicious.
}
header("Location: http://localhost:8000/index.html#/AnotherPage/abcd");
?>

вот мой машинописный код проекта Angular, который будет получать данные json, отправленные php,

 @Component({
selector: 'page-another',
templateUrl: 'another.html',
})
export class AnotherPage {

userData:any;
id:any;''

constructor(public navCtrl: NavController, public navParams: NavParams) {

this.userData = navParams.get('data');
// this.id = navParams.get('id');

console.log(navParams.get('id'));
console.log(this.userData);
}

}

1

Решение

Задача ещё не решена.

Другие решения

Других решений пока нет …

По вопросам рекламы [email protected]