[jQuery] Convert string into jQuery array

[jQuery] Convert string into jQuery array


Hi!
I have a PHP script which returns a string in a jQuery-format array.
Unfortunately doesn't jQuery recognize the string as an Array. How can
I convert the string so that jQuery understands that the string is
actually an array?
This is what the PHP-script returns at the moment:
"{    'item1': {
        'key1': 'value1',
        'key2': 'value2'
    },
    'item2': {
        'key1': 'value1',
        'key2': 'value2'
    }
}"
This is what I want jQuery to handle:
{    'item1': {
        'key1': 'value1',
        'key2': 'value2'
    },
    'item2': {
        'key1': 'value1',
        'key2': 'value2'
    }
}
Does anyone know how I can solve this?
Thank you!
// Carl-Fredrik Herö




























    • Topic Participants

    • kalle