From my PHP processing file I receive back an object ([object Object]) and I'd like to access it's content's with calls like data[0].errors etc, but all tries seem to fail for me.
How may I achieve that?
Here's what the object looks like:
" Array
(
[success] =>
[errors] => Array
(
[companyname] => Company name is required and must have 50 characters at most.
[logo1] => Logo is required.
[investment] => First investment amount is required.
[investment1] => Investment value must be an integer.
[payment] => Basic wage is required.
[payment1] => Payment value must be an integer.
[companytype] => Company type is required.
[companytype2] => Something is wrong with your company type.
)
)
"
I have to display those errors in console div to show the user what has he done wrong.
EDIT:
Here's exactly what I get when I console.log(data):

Also here's my AJAX request to make everything clear.
$.ajax({
type : 'POST',
url : 'processcreatecompany.php',
data : formData,
dataType : 'json',
contentType: false,
processData: false,
encode : true
}).done(function(data) {
console.log(data);
}).fail(function(data) {
console.log(data);
})
[object Object], thanks to Chrome developers menu i can actually see that there is the array, ill screenshot it and show you to make it clearer. ill edit question in a second @ibrahimmahrir$data['errors']array and return that to your javascript. Then, in your success callback in your AJAX call, you can parse the json string response into an object, and access the way you're expecting