Answer the question
In order to leave comments, you need to log in
How to convert json response to normal?
Hey! I can't parse data on jquery
From php I get a non-standard json response in the form:
[{"id":"1","fio":"??????????","pn":"1", "vt":"1","sr":"1","cht":"1","pt":"2","sb":"1","vs":"1","user_id ":"154","data_reg":"2015-11-18"}]
How to remove extra brackets around the edges:
php:
$result = $mysqli->query( "SELECT * FROM personal WHERE user_id='".$_SESSION["user_id"]."'" );
if (!$result) error($mysqli->error);
if ( $result->num_rows > 0 )
{
while($row = $result->fetch_assoc())
{
$myArray[] = $row;
}
echo json_encode($myArray);
}
Answer the question
In order to leave comments, you need to log in
What the hell is it, non-standard , what the hell are extra brackets if you send an array of objects from the server ...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question