Reputation: 297
I know that this question is so simple to ask, but I wasn't able to find the right answer for it, by going through many questions on stack overflow or by googling. So I found noway but to place the question here.
I have a mysql table as follow:
[0]1>>>>2>>>>>3>>>>>5>>>>>6
[1]1>>>>2>>>>>3>>>>>5>>>>>6
[2]1>>>>2>>>>>3>>>>>5>>>>>6
[3]1>>>>2>>>>>3>>>>>5>>>>>6
[4]1>>>>2>>>>>3>>>>>5>>>>>6
[5]1>>>>2>>>>>3>>>>>5>>>>>6
I need to store it in a variable and parse it with json back to the ajax function, but the result I get is [object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],
Here is the php code:
$ent = $_POST['id'];
$column = array();
$gtord = mysql_query("SELECT * FROM order WHERE oId = '$ent' ");
while($rowmnu2=mysql_fetch_assoc($gtord))
{
$column[] = array($rowmnu2);
}
echo json_encode($column);
here is the ajax function:
$.ajax({
type: 'POST',
url: "profile/ajax/getorder.php",
data: {id:gotid},
dataType: 'json',
cache: false,
success: function(result) {
alert(result);
},
});
I am sure that there is an error in my ajax code success alert, but I am not able to figure it out, how to go through the received array.
Please help me. Appreciated in advance.
Upvotes: 1
Views: 2504