I'm trying to get my data into an array of strings so that I can use it as a dataset for jquery autocomplete. What I'm getting now is an array of objects, which I don't think will work.
Jquery on my main page:
$.get("get_schools.php", function(data) {
var results = jQuery.parseJSON(data);
alert(results);
});
This results in data in the format of: [object Object],[object Object],[object Object]
On get_schools.php: I query a database and the return the results to an array called $displaynames. Then:
echo json_encode($displaynames);
Which looks like: [{"DisplayName":"XXXX Street Middle School"},{"DisplayName":"XXXXX Schools"},{"DisplayName":"XXXX Elementary School"}
UPDATE: this question has been flagged as a possible duplicate, but the other question pertains to getting a property of an object. i wasn't attempting to get a property of an object. i was attempting to convert an object array to an array of strings. i needed the property names as well as the values in the result. the other question only returns the values.