Use Php Array In Javascript?
my php code looks like this: $result['firstName']['lastName']='johan'; echo json_encode($result); how should i type to use this array in javascript with jquery? ...function(data)
Solution 1:
JQuery doesn't effect object access, so you can just do
data.firstName.lastName
Solution 2:
Javascript doesn't technically have associative arrays, so technically in Javascript you're working with an Object. Either syntax you used should work.
Post a Comment for "Use Php Array In Javascript?"