A quick question
Does php function json_encode or js JSON.parse function drops '+' character by default? I definitely get a '+' lost somewhere and at cannot figure out where. This is quite urgent as it's actually an xml feed from realex, which authorizes (or in this case doesn't authorize) payments on one of our live sites. To make things more complex, I cannot use dev environment at the moment and I cannot play in printing out values on the screen on the live site. So I'm trying to make a guessed-fix for the start
Ok, here's some exmaple
I get a value from Realex
$RESPONSE_THREEDSECURE_CAVV = 'jFvMUENpUEzLARAQBtmeh+Q5o/U=';
$parametersToPass['cavv'] = $RESPONSE_THREEDSECURE_CAVV;
There are more values in parametersToPass array, but this is the one that's causing troubles. I encode it in php
$encoded = json_encode($parametersToPass);
die($encoded);
This is being returned in jquery ajax call success as 'data'
success: function(data) {
$.ajax({
type: "POST",
url: 'action/payment-process_auth.php',
data: "data="+data
});
}
I retieve it in payment-process-auth
$decoded = json_decode($_POST['data']);
$parametersToPass['cavv'] = $decoded->cavv;
At this point cavv value is jFvMUENpUEzLARAQBtmeh Q5o/U= instead of jFvMUENpUEzLARAQBtmeh+Q5o/U= (space instead of a +)
How can I sort this out?
+character part of a string ? can you share the JSON ?