I'm wondering how I can get a JSON format to an array or something usable for me.
I've got the following;
The index.php contains;
- {"playlist":[{"media_id":"9470","filename":"NEW_4.jpg"}]}
The code:
- var playlist_array = new Array();
- function update()
- {
- $.get('index.php', {extension:'screen'},
- function(data)
- {
- playlist_array = data['playlist'];
- }, "json");
- }
- function hello()
- {
- alert(playlist_array[0]['filename']);
- }
- update();
- hello();
playlist_array[0]['filename'] always is undefined :(
Where 0 can be different integers because the array will be bigger.
Does anyone has an idea how to do this?