I have the following PHP code which encodes a PHP array:
Code
$js_array = json_encode($tmp);
Output
{
"frfgt55":["ABC","frfgt55","Aberdeen"],
"vfrgt6":["ABC","vfrgt6","Birmingham"],
"vbgtfdh67":["XYZ","vbgtfdh67","Leeds"],
"vfe5gb":["XYZ","vfe5gb","Bristol"],...
}
What I am struggling with is to then access this within a jQuery script. I know I should be making use of $.getJSON
but I am struggling with its implementation as my Ajax knowledge is limited. I cannot see how this would access the variable that as been encoded.
Ajax code
$.getJSON('../_client/index.php', function(data) {
/* data will hold the php array as a javascript object */
});
Any advice, feedback and comments welcomed.