I'm trying to communicate AJAX, JSON to PHP and then PHP returns some data and I'm trying to parse it with Javascrpt.
From the php, server I return,
    echo json_encode($data); 
    // it outputs ["123","something","and more something"]
and then in client-side,
success : function(data){
    //I want the data as following
    // data[0] = 123
    // data[1] = something
    // data[3] = and more something
}
But, it gives as;
        data[0] = [ 
        data[1] = " 
        data[2] = 1
It is reading each character but I want strings from the array, not individual characters. What is happening here? Thanks in advance, I am new to Javascript and JSON, AJAX.
JSON.parse(data) should do the trick.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With