Will the Order of my Associative Array be maintained from PHP to Javascript?

Posted by Colin on Stack Overflow See other posts from Stack Overflow or by Colin
Published on 2010-04-22T01:12:59Z Indexed on 2010/04/22 1:13 UTC
Read the original article Hit count: 218

Filed under:
|
|
|

In PHP I'm running a mysql_query that has an ORDER BY clause. I'm then iterating through the results to build an associative array, with the row_id as the key.

Then, I'm calling json_encode on that array and outputting the result.

This page is loaded with AJAX, and defined in a Javascript variable. When I iterate through that Javascript variable, will I still have the order that was returned from the mysql_query?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about AJAX