I'm tryint to set a js variable with the result of a php code using json, but it isn't working. The code below shows what i'm trying to do.
The PHP is returning this.
echo json_encode($row['total']);
I'm trying to recover the variable in js, this is the code.
var total = $.getJSON('totalDeImoveis.php?id=316');
What am I doing wrong?