I have a PHP script that retrieves names (strings) from database. I would like to pass this array to Javascript using $.ajax(). I cannot understand how should I encode the a
This is Php File Code
Then you can parse $array in your $.ajax() like this
$array
$.ajax()
success: function (data) { var x = JSON.parse(data); console.log(x); }