From a database query I'm getting one record returned with fields/values and putting it into an array:
$arr = array();
while ($rowSearchZipCode = mysqli_fetch_array($resultSearchZipCode, MYSQLI_ASSOC)) {
$arr[] = $rowSearchZipCode;
}
I'm sending this back to a jQuery ajax call via an echo from the php script:
echo print_r($arr);
Displaying the array in an alert box in the success parameter of $.ajax shows me that I'm getting a multidimensional array that looks like this:
Array
(
[0] => Array
(
[id] => 55
[branchName] => SBN - Some Branch Name
[branchAddress1] => 1234 Elm St.
[branchAddress2] => Suite 000
[branchAddressCity] => Anywhere
[branchAddressState] => CA
[branchAddressZip] => 55000
[branchAddressPhone] => 555-555-5555
[branchAddressFax] => 555-555-4444
)
)
1
Question 1: Am I building the array correctly in the while loop?
Question 2: In the $.ajax call how do I get the field/value pairs from the array so that I can output them to HTML tags, etc?