Inside the Zend frame.
$res = $db->query ("Select name from Job_type where tid= $type")->fetchall ();
I'm putting an array out of this thing:
Array (2) {[0]=> Array (1) {["Name"]=> string (6) "Mechanic"} [1]=> Array (1) {["Name"]=> string (6) "Pu"}}
Reply to discussion (solution)
Json_encode
Why don't you read the manual?
Json_encode
Inside the Zend frame.
$res = $db->query ("Select name from Job_type where tid= $type")->fetchall ();
I'm putting an array out of this thing:
Array (2) {[0]=> Array (1) {["Name"]=> string (6) "Mechanic"} [1]=> Array (1) {["Name"]=> string (6) "Pu"}}
I just do it, and then he can return to the JS JSON data format?
$res = $db->query ("Select name from Job_type where tid= $type")->fetchall ();
Json_encode ($res);
Echo $res;
Exit ();
And then in JS also did not write the data did not hit out, how can I view the specific format of the JSON data conversion, it is supposed to say how my data taken wrong, should also hit something out Ah, but nothing is the amount:
if (myxmlhttprequest.readystate==4) {
Alert ("return" +myxmlhttprequest.responsetext);
var Mes=myxmlhttprequest.responsetext;
var mes_obj=eval ("(" +mes+ ")");
for (Var i=0,mes_obj.length;i++) {
Alert (mes_obj[i].[ Name]);
}
}
$res =json_encode ($res);
Echo $res;
Exit ();