Basically what I'm trying to do is return the results of a mysql query. I know how to put each row of query results in my own JSON object, now I just struggle to get multiple rows of results to return it to my jquery. In my jquery, I call the $ .ajax () function, and I have no problem with that. My problem is in the success part, where I want to be able to do something like the following:
$.ajax ({
type: "POST",
url:"select.php",
data: {columns : "*",
table : "tbUsers",
conditions : "" },
success: function(results) {
foreach (results as obj)
{
JSON.parse(obj);
$("#page").html(obj.id + " " + obj.name);
}
}
});
, , JSON. - , php. , , ?
php - :
[{"0":1, "1":"name1", "id":1, "name":"name1"} , {"0":2, "1":"name2", "id":2, "name":"name2"}]