I have a JS function which I'm passing some JSON. I produce this JSON with PHP:
<?php
$array[] = array('hello','123','456');
echo json_encode($array);
?>
This gives me something neat for JS like:
[["hello","123","456"]]
My JS function seems to like this format.
The problem I have however is when I produce a similar array directly in JS like so:
var json = [[text_var,number_var,number_var]]; // these vars established earlier in the code
var json_stringify = JSON.stringify(json);
I wind up with something that looks like this:
[["hello",123,456]]
So basically, it isn't encapsulating my numbers with quotes. I wouldn't think it would matter, but without them I get a Uncaught RangeError: Maximum call stack size exceeded
I tried doing something like preparing the JSON myself with:
var json = '[["'+place_name+'","'+longitude+'","'+latitude+'"]]';
But passing that it doesn't like either - maybe it isn't feeling it as a JSON var, and I've tried parsing that through JSON.stringify but I end up with backslashes before every quote and it doesn't like that either.
What is my feeble mind not seeing here?
EDIT: My PHP array is in another array hence the result of [["hello',"123","456"]] and not single brackets [ ]