-1
In performing echo json_encode($data);
, I am receiving ,via console.debug(data)
, the following:
<br />
<font size='1'><table class='xdebug-error xe-notice' dir='ltr' border='1' cellspacing='0' cellpadding='1'>
<tr><th align='left' bgcolor='#f57900' colspan="5"><span style='background-color: #cc0000; color: #fce94f; font-size: x-large;'>( ! )</span> Notice: Undefined variable: v_prod_total in C:\wamp64\www\nfe\admin\nfephp-master\exemplos\NFe\4.00testaMakeNFe.php on line <i>464</i></th></tr>
<tr><th align='left' bgcolor='#e9b96e' colspan='5'>Call Stack</th></tr>
<tr><th align='center' bgcolor='#eeeeec'>#</th><th align='left' bgcolor='#eeeeec'>Time</th><th align='left' bgcolor='#eeeeec'>Memory</th><th align='left' bgcolor='#eeeeec'>Function</th><th align='left' bgcolor='#eeeeec'>Location</th></tr>
<tr><td bgcolor='#eeeeec' align='center'>1</td><td bgcolor='#eeeeec' align='center'>0.0020</td><td bgcolor='#eeeeec' align='right'>424896</td><td bgcolor='#eeeeec'>{main}( )</td><td title='C:\wamp64\www\nfe\admin\nfephp-master\exemplos\NFe\4.00testaMakeNFe.php' bgcolor='#eeeeec'>...\4.00testaMakeNFe.php<b>:
What might be going on?
Script:
$http({
method : 'POST',
url : 'enviar.php',
dataType: 'json',
data : dados: dados ,
headers : {'Content-Type': 'application/x-www-form-urlencoded'}
})
.success(function(data) {
if (data.errors) {
$scope.erroValidar = "Erro";
} else {
$scope.key = data.chave;
console.debug(data);
}
})
Note: json_encode is among a "multitude" of PHP code
try{
$query = $conecta->prepare('SELECT * FROM empresas WHERE situacao=1');
$query->execute();
$resultado = $query->fetchAll(PDO::FETCH_ASSOC);
}catch (PDOexception $erro){
echo 'Erro ao selecionar: '.$erro->getMessage();
}
foreach($resultado as $res){
$razao_social_emt = $res['cidade'];
$nome_fantasia_emt = $res['nome_fantasia'];
$cnpj_emt = $res['cnpj'];
$insc_estadual_emt = $res['insc_estadual'];
$logradouro_emt = $res['logradouro'];
$numero_emt = $res['numero'];
.
.
.
echo json_encode($data);
.
.
.
else {
header('Content-type: text/html; charset=UTF-8');
foreach ($nfe->erros as $err) {
echo 'tag: <'.$err['tag'].'> ---- '.$err['desc'].'<br>';
}
}
?>
json_encode is not returning a string containing the JSON representation of the values.
– lucasbento
do tipo: {"a":1,"b":2,"c":3,"d":4,"e":5}
– lucasbento