I'm trying to get a PHP array with AJAX and turn it into a JSON array.
Right now in the external file I'm echoing the php array with JSON encoding:
echo json_encode($palabras);
Then on the main file I get the response and assign it to variable "jsarray ";
success:function(data_response){
jsarray = data_response;
}});
However I can't access jsarray as an array. How can I turn it into a proper array I can access?
console.log(jsarray)in thesuccessfunction and have a look. If nothing is logged thensucesswas not called -> error occured. In that case edit your question and add exact output from your php page echoing JSON and also client-side code that is using AJAX.[{"palabra":"uno"},{"palabra":"dos"}]