I have a very simple question and am amazed I haven't figured it out yet. What am I missing? I get a php array through json encoding:
var curr_op = <?php echo json_encode($options) ?>;
The console.log(curr_op) reads:
[14:35:00.889] ({' ':" ", 'Tangential-S1':"Tangential-S1", 'Diagonal-Q1':"Diagonal-Q1", addnew:"Add New"})
and I would like to pass just the keys (or values) to html via:
$('#modal-body span2').html(JSON.stringify(curr_op));
which gives me an ugly thing:
{" ":" ","Tangential-S1":"Tangential-S1","Diagonal-Q1":"Diagonal-Q1","addnew":"Add New"}
in my webpage. How do I clean this up and only pass something like:
Tangential-S1, Diagonal-Q1
To the html (note the first and last elements should be removed too).